Skip to content

Instantly share code, notes, and snippets.

@anandthakker
Last active June 22, 2019 06:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anandthakker/40464d1e684ba5857e12c87821bb3664 to your computer and use it in GitHub Desktop.
Save anandthakker/40464d1e684ba5857e12c87821bb3664 to your computer and use it in GitHub Desktop.
const dm = require('deepmerge');
if (typeof dm !== 'function') {
throw new Error("require('deepmerge') is not a function");
}
import dm from 'deepmerge';
if (typeof dm !== 'function') {
throw new Error("require('deepmerge') is not a function");
}
{
"name": "webpack-cjs-issue",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"deepmerge": "^2.1.0",
"webpack": "^4.5.0"
},
"devDependencies": {
"webpack-cli": "^2.0.14"
},
"scripts": {
"test-webpack": "webpack && node dist/bundle.js",
"test-node-cjs": "node index.js",
"test-node-esm": "node --experimental-modules index.mjs"
}
}
module.exports = {
entry: './index.js',
output: {
filename: 'bundle.js'
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment