Skip to content

Commit

Permalink
create bundle version
Browse files Browse the repository at this point in the history
  • Loading branch information
sgratzl committed Oct 4, 2018
1 parent e120f03 commit d1664cc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -15,10 +15,10 @@
"type": "git",
"url": "https://github.com/datavisyn/lineupjsx.git"
},
"main": "build/LineUpJSx.js",
"main": "build/LineUpJSx.bundle.js",
"jsnext:main": "build/LineUpJSx.js",
"module": "build/LineUpJSx.js",
"unpkg": "build/LineUpJSx.js",
"unpkg": "build/LineUpJSx.bundle.js",
"types": "src/index.d.ts",
"sideEffects": [
"*.scss",
Expand Down
18 changes: 16 additions & 2 deletions webpack.config.js
Expand Up @@ -20,7 +20,7 @@ const banner = '/*! ' + (pkg.title || pkg.name) + ' - v' + pkg.version + ' - ' +
*/
module.exports = (env, options) => {
const dev = options.mode.startsWith('d');
return {
const config = {
node: false, // no polyfills
entry: dev ? {
LineUpJSx: './src/index.tsx',
Expand Down Expand Up @@ -70,7 +70,7 @@ module.exports = (env, options) => {
root: 'React',
commonjs: 'react',
commonjs2: 'react'
},,
},
'react-dom': {
amd: 'react-dom',
root: 'ReactDOM',
Expand Down Expand Up @@ -151,4 +151,18 @@ module.exports = (env, options) => {
contentBase: 'demo'
}
};

if (dev) {
return config;
}

// create a bundled version, too
const bundle = Object.assign({}, config);
bundle.entry = {
'LineUpJSx.bundle': './src/index.tsx'
}
bundle.externals = Object.assign({}, config.externals);
delete bundle.externals.lineupjs;

return [config, bundle];
};

0 comments on commit d1664cc

Please sign in to comment.