Skip to content

Commit

Permalink
Initial attempt at fixing sinonjs#1805
Browse files Browse the repository at this point in the history
See sinonjs#1805

Not functional bundle. Gets this error:

$ node -r esm -e 'import sinon from ./bundle-esm'
file:///home/carlerik/dev/sinon/bundle-esm.js:1
import typeDetect from 'type-detect';

SyntaxError: Missing export 'default' in ES module: file:///home/carlerik/dev/sinon/node_modules/diff/lib/index.js
    at Object.<anonymous> (file:///home/carlerik/dev/sinon/bundle-esm.js:1)
  • Loading branch information
fatso83 committed May 25, 2018
1 parent e641e58 commit 845a2b8
Show file tree
Hide file tree
Showing 3 changed files with 153 additions and 12 deletions.
116 changes: 104 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"test": "run-s test-node test-headless test-webworker test-es-module",
"check-dependencies": "dependency-check package.json --unused --no-dev --ignore-module coveralls --ignore-module esm",
"build": "node ./build.js",
"build-esm": "rollup -c",
"lint": "run-p lint-js lint-markdown",
"lint-js": "eslint '**/*.{js,mjs}'",
"lint-markdown": "find docs -type f -name '*.md' ! -name 'changelog.md' | xargs markdownlint",
Expand All @@ -45,6 +46,7 @@
"lodash.get": "^4.4.2",
"lolex": "^2.6.0",
"nise": "^1.3.3",
"rollup": "^0.59.3",
"supports-color": "^5.4.0",
"type-detect": "^4.0.8"
},
Expand All @@ -69,6 +71,7 @@
"proxyquire-universal": "^1.0.8",
"proxyquireify": "^3.2.1",
"rimraf": "^2.5.3",
"rollup-plugin-commonjs": "^9.1.3",
"samsam": "^1.3.0"
},
"files": [
Expand Down
46 changes: 46 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// rollup.config.js
import commonjs from "rollup-plugin-commonjs";
//import nodeResolve from "rollup-plugin-node-resolve";

export default {
input: "./lib/sinon.js",
output: {
file: "pkg/bundle-esm.js",
format: "esm"
},
plugins: [
//nodeResolve({
//jsnext: true,
//main: true
//}),

commonjs({
// non-CommonJS modules will be ignored, but you can also
// specifically include/exclude files
//include: "node_modules/**", // Default: undefined
//exclude: ["node_modules/foo/**", "node_modules/bar/**"], // Default: undefined
// these values can also be regular expressions
// include: /node_modules/

// search for files other than .js files (must already
// be transpiled by a previous plugin!)
//extensions: [".js", ".coffee"], // Default: [ '.js' ]

// if true then uses of `global` won't be dealt with by this plugin
ignoreGlobal: false, // Default: false

// if false then skip sourceMap generation for CommonJS modules
sourceMap: false // Default: true

// explicitly specify unresolvable named exports
// (see below for more details)
//namedExports: { "./module.js": ["foo", "bar"] }, // Default: undefined

// sometimes you have to leave require statements
// unconverted. Pass an array containing the IDs
// or a `id => boolean` function. Only use this
// option if you know what you're doing!
//ignore: ["conditional-runtime-dependency"]
})
]
};

0 comments on commit 845a2b8

Please sign in to comment.