From 4f1f88c8f88b3b41959dfcd45c6a579d0ac8dcab Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Tue, 27 Apr 2021 15:00:43 +0200 Subject: [PATCH] Remove useless commandLineArgs.input manipulation --- rollup.config.js | 93 +++++++++++++++++++++++------------------------- 1 file changed, 44 insertions(+), 49 deletions(-) diff --git a/rollup.config.js b/rollup.config.js index 3985c2b..a17b5f6 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -12,59 +12,54 @@ const buildDir = process.env.BUILD_DIR; const publicDir = process.env.PUBLIC_DIR; const input = process.env.INPUT.split(':'); -export default commandLineArgs => { - const type = commandLineArgs.input; - delete commandLineArgs.input; - - return { - input: input, - output: { - sourcemap: true, - format: 'es', - name: 'bundle', - dir: path.join(publicDir, 'js'), - entryFileNames: (chunkInfo) => { - const name = chunkInfo.facadeModuleId ? - path.relative(buildDir, chunkInfo.facadeModuleId) : - chunkInfo.name; - return name + '.js'; - }, +export default commandLineArgs => ({ + input: input, + output: { + sourcemap: true, + format: 'es', + name: 'bundle', + dir: path.join(publicDir, 'js'), + entryFileNames: (chunkInfo) => { + const name = chunkInfo.facadeModuleId ? + path.relative(buildDir, chunkInfo.facadeModuleId) : + chunkInfo.name; + return name + '.js'; }, - plugins: [ - svelte({ - preprocess: sveltePreprocess({ - typescript: { - tsconfigFile: 'tsconfig.views.json', - }, - }), - compilerOptions: { - dev: !production, - hydratable: true, + }, + plugins: [ + svelte({ + preprocess: sveltePreprocess({ + typescript: { + tsconfigFile: 'tsconfig.views.json', }, }), + compilerOptions: { + dev: !production, + hydratable: true, + }, + }), - // Extract css into separate files - cssOnlyRollupPlugin({output: 'bundle.css'}), + // Extract css into separate files + cssOnlyRollupPlugin({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/commonjs - resolve({ - browser: true, - dedupe: ['svelte'], - }), - commonjs(), + // 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/commonjs + resolve({ + browser: true, + dedupe: ['svelte'], + }), + commonjs(), - // Live reload in dev - !production && !!commandLineArgs.watch && livereloadRollupPlugin('public'), + // Live reload in dev + !production && !!commandLineArgs.watch && livereloadRollupPlugin('public'), - // Minify in production - production && terser(), - ], - watch: { - clearScreen: false, - }, - }; -}; + // Minify in production + production && terser(), + ], + watch: { + clearScreen: false, + }, +});