Skip to content

Commit

Permalink
fix: fix bundle output
Browse files Browse the repository at this point in the history
  • Loading branch information
welingtonms committed Jun 26, 2021
1 parent d15babf commit d0df5c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@cheesebit/use-slice",
"version": "0.1.1",
"description": "Provides a React hook similar to the Redux Toolkit createSlice.",
"module": "dist/use-slice.js",
"main": "dist/use-slice.js",
"files": [
"dist"
],
Expand Down
8 changes: 3 additions & 5 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ import resolve from '@rollup/plugin-node-resolve';
module.exports = [
{
input: 'src/index.js',
output: [
{ name: 'use-slice', file: pkg.module, format: 'es' },
],
output: [{ name: 'use-slice', file: pkg.main, format: 'cjs' }],
plugins: [
del({ targets: [`dist/`] }),
resolve({
// Source: https://rollupjs.org/guide/en/#peer-dependencies
moduleDirectory: ['node_modules',],
moduleDirectory: ['node_modules'],
}), // so Rollup can find `ms`
commonjs(), // so Rollup can convert `ms` to an ES module
babel({
Expand All @@ -27,7 +25,7 @@ module.exports = [
analyze({
hideDeps: true,
summaryOnly: true,
filter: module => /^\/src/.test(module.id),
filter: (module) => /^\/src/.test(module.id),
}),
],
external: ['react'],
Expand Down

0 comments on commit d0df5c8

Please sign in to comment.