Skip to content

Instantly share code, notes, and snippets.

@luobotang
Created February 20, 2019 08:37
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 luobotang/6a373a141bea8bc0f2fbdfadcb09841f to your computer and use it in GitHub Desktop.
Save luobotang/6a373a141bea8bc0f2fbdfadcb09841f to your computer and use it in GitHub Desktop.
DEMO - Error of assign to read only 'exports' of object - caused by webpack and @babel/preset-env with special config
module.exports = {
presets: [
[
'@babel/env',
{
useBuiltIns: 'usage',
modules: false
}
]
]
}
module.exports = x.toString()
{
"name": "demo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack"
},
"keywords": [],
"author": "luobotang",
"license": "MIT",
"dependencies": {
"@babel/core": "^7.2.2",
"@babel/polyfill": "^7.2.5",
"@babel/preset-env": "^7.2.3",
"babel-loader": "^8.0.5",
"webpack": "^4.28.4",
"webpack-cli": "^3.2.1"
}
}
module.exports = {
mode: 'production',
entry: './src.js',
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader'
}
]
},
optimization: {
minimize: false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment