Skip to content

Commit

Permalink
feat(package): rollup build for tao-router complete (CJS + ESM)
Browse files Browse the repository at this point in the history
affects: @tao.js/router
  • Loading branch information
eudaimos committed Jun 1, 2019
1 parent c9c03bf commit 94faa45
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 36 deletions.
1 change: 0 additions & 1 deletion packages/tao-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"repository": "https://github.com/zzyzxlab/tao.js/tree/master/packages/tao-router",
"main": "lib",
"module": "dist",
"browser": "bundles/browser.umd.js",
"bundles": {
"browser": "bundles/browser.umd.js"
},
Expand Down
76 changes: 41 additions & 35 deletions packages/tao-router/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,40 +34,46 @@ export default [
json(),
commonjs()
]
}
},

// // CommonJS (for Node) and ES module (for bundlers) build.
// // (We could have three entries in the configuration array
// // instead of two, but it's quicker to generate multiple
// // builds from a single configuration where possible, using
// // an array for the `output` option, where we can specify
// // `file` and `format` for each target)
// {
// input: {
// index: 'src/index.js'
// },
// output: [
// {
// dir: pkg.main,
// format: 'cjs',
// sourcemap: true,
// exports: 'named'
// },
// {
// dir: pkg.module,
// format: 'esm',
// sourcemap: true,
// exports: 'named'
// }
// ],
// plugins: [
// babel({
// runtimeHelpers: true,
// exclude: ['node_modules/**']
// }),
// external(),
// resolve(),
// commonjs()
// ]
// }
// CommonJS (for Node) and ES module (for bundlers) build.
// (We could have three entries in the configuration array
// instead of two, but it's quicker to generate multiple
// builds from a single configuration where possible, using
// an array for the `output` option, where we can specify
// `file` and `format` for each target)
{
input: {
index: 'src/index.js'
},
output: [
{
dir: pkg.main,
format: 'cjs',
sourcemap: true,
exports: 'named'
},
{
dir: pkg.module,
format: 'esm',
sourcemap: true,
exports: 'named'
}
],
external: ['history'],
plugins: [
external(),
babel({
runtimeHelpers: true,
exclude: ['node_modules/**']
}),
external(),
resolve({
preferBuiltins: false,
browser: true
}),
json(),
commonjs()
]
}
];

0 comments on commit 94faa45

Please sign in to comment.