You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, i tried to get HMR working on my project by moving the rollup config from this repo to my project
importsveltefrom'rollup-plugin-svelte';importcommonjsfrom'@rollup/plugin-commonjs';importresolvefrom'@rollup/plugin-node-resolve';importlivereloadfrom'rollup-plugin-livereload';import{terser}from'rollup-plugin-terser';importsveltePreprocessfrom'svelte-preprocess';importtypescriptfrom'@rollup/plugin-typescript';importcssfrom'rollup-plugin-css-only';importscssfrom"rollup-plugin-scss";importreplacefrom'rollup-plugin-replace';importhmrfrom'rollup-plugin-hot'constproduction=!process.env.ROLLUP_WATCH;constisNollup=!!process.env.NOLLUPconstisWatch=!!process.env.ROLLUP_WATCHconstisLiveReload=!!process.env.LIVERELOADconstisDev=isWatch||isLiveReloadconstisProduction=!isDevconstisHot=isWatch&&!isLiveReloadfunctionserve(){letserver;functiontoExit(){if(server)server.kill(0);}return{writeBundle(){if(server)return;server=require('child_process').spawn('npm',['run','start','--','--dev'],{stdio: ['ignore','inherit','inherit'],shell: true});process.on('SIGTERM',toExit);process.on('exit',toExit);}};}exportdefault{input: 'src/main.ts',output: {sourcemap: true,format: 'iife',name: 'app',dir: 'public/build/',chunkFileNames: '[name].js',exports: "named"},inlineDynamicImports: true,plugins: [replace({'process.env.NODE_ENV': JSON.stringify('production')}),svelte({preprocess: [sveltePreprocess({sourceMap: !production})],compilerOptions: {// enable run-time checks when not in productiondev: !production,cssHash: function(option){return`_${option.hash(option.css)}`;},css: css=>{css.write('bundle.css')},}}),// we'll extract any component CSS out into// a separate file - better for performancescss({output: 'public/build/bundle.css'}),css({output: 'bundle.css'}),// If you have external dependencies installed from// npm, you'll most likely need these plugins. In// some cases you'll need additional configuration -// consult the documentation for details:// https://github.com/rollup/plugins/tree/master/packages/commonjsresolve({browser: true,dedupe: ['svelte']}),commonjs(),typescript({include: ['./**/*.ts','./../network/**/*.ts','./../shared/**/*.ts'],sourceMap: !production,inlineSources: !production}),// In dev mode, call `npm run start` once// the bundle has been generatedisDev&&!isNollup&&serve(),// Watch the `public` directory and refresh the// browser on changes when not in productionisLiveReload&&livereload('public'),// If we're building for production (npm run build// instead of npm run dev), minifyisProduction&&terser(),hmr({public: 'public',inMemory: true,host: '0.0.0.0',port: 35729,compatModuleHot: !isHot,})],watch: {clearScreen: false}};
i ended up this way, and everything works except when i change css/scss Code... The Module reloads with the new CSS hash, but the new CSS Code isnt injected to the dom so I have broken design / missing styles.
The text was updated successfully, but these errors were encountered:
Hello, i tried to get HMR working on my project by moving the rollup config from this repo to my project
i ended up this way, and everything works except when i change css/scss Code... The Module reloads with the new CSS hash, but the new CSS Code isnt injected to the dom so I have broken design / missing styles.
The text was updated successfully, but these errors were encountered: