Skip to content

Commit

Permalink
fix(shipjs-lib): exclude dependencies from final bundle (#651)
Browse files Browse the repository at this point in the history
* add all dependencies to rollup externals

* use imports

Co-authored-by: Eunjae Lee <[email protected]>
  • Loading branch information
jeetiss and Eunjae Lee committed Mar 6, 2020
1 parent cd43798 commit f6ec4cf
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/shipjs-lib/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default [
{
input: 'src/index.js',
output: [{ file: pkg.main, format: 'es' }],
external: ['fs', 'path', 'url'],
external: ['fs', 'path', 'url'].concat(Object.keys(pkg.dependencies)),
plugins: [resolve({ preferBuiltins: true }), commonjs()],
},
];
2 changes: 1 addition & 1 deletion packages/shipjs-lib/src/lib/config/mergeConfig.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const merge = require('deepmerge');
import merge from 'deepmerge';

export default function mergeConfig(config1, config2) {
const config = {
Expand Down
15 changes: 1 addition & 14 deletions packages/shipjs-lib/src/lib/shell/exec.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
const shell = require('shelljs');
/*
This used to be `import shell from 'shelljs'`.
For some reason I don't know, it broke the build.
`var shellMethods = Object.create(shell);`
The line above is from the build output.
At the time it was executed, there was no `shell` defined yet.
So it threw the following:
TypeError: Object prototype may only be an Object or null: undefined
I tried many different things to fix this, but couldn't find a solution.
Using `require` instead of `import` is the only workaround at the moment.
*/
import shell from 'shelljs';

export default function exec(
command,
Expand Down

0 comments on commit f6ec4cf

Please sign in to comment.