Skip to content

Commit

Permalink
Remove usage of jsnext option from rollup-plugin-node-resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
Andarist committed Oct 29, 2019
1 parent 2cd5077 commit 1ab7afc
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,72 +29,70 @@ const createConfig = ({ output, browser = false, umd = false, env } = {}) => {
name: 'TextareaAutosize',
exports: 'named',
globals: {
react: 'React'
}
})
react: 'React',
},
}),
),
plugins: [
nodeResolve({
jsnext: true
}),
nodeResolve(),
babel({
exclude: 'node_modules/**',
runtimeHelpers: true,
plugins: [
[
'@babel/transform-runtime',
{ useESModules: output.format !== 'cjs' }
]
]
{ useESModules: output.format !== 'cjs' },
],
],
}),
commonjs(),
replace(
Object.assign(
env ? { 'process.env.NODE_ENV': JSON.stringify(env) } : {},
{
'process.env.BROWSER': JSON.stringify(browser)
}
)
'process.env.BROWSER': JSON.stringify(browser),
},
),
),
min &&
uglify({
compress: {
pure_getters: true,
unsafe: true,
unsafe_comps: true,
warnings: false
}
})
warnings: false,
},
}),
].filter(Boolean),
external: makeExternalPredicate(umd ? external : allExternal)
external: makeExternalPredicate(umd ? external : allExternal),
};
};

const configs = {
browser_cjs: {
output: { file: pkg.browser[pkg.main], format: 'cjs' },
browser: true
browser: true,
},
browser_esm: {
output: { file: pkg.browser[pkg.module], format: 'esm' },
browser: true
browser: true,
},
regular_cjs: {
output: { file: pkg.main, format: 'cjs' }
output: { file: pkg.main, format: 'cjs' },
},
regular_esm: {
output: { file: pkg.module, format: 'esm' }
output: { file: pkg.module, format: 'esm' },
},
umd_prod: {
output: { file: pkg.unpkg.replace(/\.min\.js$/, '.js'), format: 'umd' },
umd: true,
env: 'development'
env: 'development',
},
umd: {
output: { file: pkg.unpkg, format: 'umd' },
umd: true,
env: 'production'
}
env: 'production',
},
};

const buildTypes = Object.keys(configs);
Expand Down

0 comments on commit 1ab7afc

Please sign in to comment.