Skip to content

Commit

Permalink
exclude dependencies from package
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolodavis committed Feb 8, 2018
1 parent d8ba2b1 commit 9e507ce
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions rollup.npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,19 @@ const env = process.env.NODE_ENV;
const plugins = [
postcss(),
babel({ exclude: '**/node_modules/**' }),
commonjs(),
resolve({ browser: true }),
filesize(),
];

const globals = {
react: 'React',
redux: 'Redux',
'prop-types': 'PropTypes',
'react-redux': 'ReactRedux',
'react-json-view': 'ReactJson',
mousetrap: 'Mousetrap',
'socket.io-client': 'io',
};

export default [
// Sub-packages.
{
Expand All @@ -43,8 +51,8 @@ export default [

{
input: 'packages/client.js',
external: ['react'],
globals: { react: 'React' },
external: Object.keys(globals),
globals,
output: { file: 'dist/client.js', format: 'umd' },
name: 'Client',
plugins: plugins,
Expand All @@ -59,8 +67,8 @@ export default [

{
input: 'packages/ui.js',
external: ['react'],
globals: { react: 'React' },
external: Object.keys(globals),
globals,
output: { file: 'dist/ui.js', format: 'umd' },
name: 'UI',
plugins: plugins,
Expand All @@ -69,8 +77,8 @@ export default [
// UMD and ES versions.
{
input: 'packages/main.js',
external: ['react'],
globals: { react: 'React' },
external: Object.keys(globals),
globals,
output: [
{ file: pkg.main, format: 'umd', name: 'BoardgameIO' },
{ file: pkg.module, format: 'es' },
Expand All @@ -83,11 +91,13 @@ export default [
// Browser minified version.
{
input: 'packages/main.js',
external: ['react'],
globals: { react: 'React' },
external: ['react'],
output: [{ file: pkg.unpkg, format: 'umd' }],
name: 'BoardgameIO',
plugins: plugins.concat([
commonjs(),
resolve({ browser: true }),
replace({
'process.env.NODE_ENV': JSON.stringify('production'),
}),
Expand Down

1 comment on commit 9e507ce

@nicolodavis
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.