From 63ce76a552aa387277ed5a86e886e4c4243e0a3b Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Thu, 26 Dec 2019 17:19:26 +0200 Subject: [PATCH] typescript(option): fix: fixed lib not beeing tree-shakeable Signed-off-by: prescientmoon --- typescript/option/rollup.config.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/typescript/option/rollup.config.ts b/typescript/option/rollup.config.ts index bad4d26..3e67884 100644 --- a/typescript/option/rollup.config.ts +++ b/typescript/option/rollup.config.ts @@ -1,19 +1,19 @@ import { terser } from 'rollup-plugin-terser' import { resolve } from 'path' import ts from '@wessberg/rollup-plugin-ts' +import nodeResolve from '@rollup/plugin-node-resolve' +import commonjs from '@rollup/plugin-commonjs' const outputDirectory = resolve(__dirname, 'dist') const inputFile = resolve(__dirname, 'src/index.ts') -const npmConfig = require(resolve(__dirname, `package.json`)) - -const external = Object.keys(npmConfig.dependencies || {}) const dev = Boolean(process.env.ROLLUP_WATCH) +const commonPlugins = [commonjs(), nodeResolve()] + export default [ { input: inputFile, - external, output: [ { file: `${outputDirectory}/index.cjs.js`, @@ -27,11 +27,10 @@ export default [ name: 'Option' } ], - plugins: [ts(), !dev && terser()] + plugins: [...commonPlugins, ts(), !dev && terser()] }, { input: inputFile, - external, output: [ { file: `${outputDirectory}/index.esm.js`, @@ -40,6 +39,7 @@ export default [ } ], plugins: [ + ...commonPlugins, ts({ tsconfig: { declaration: true,