I tried to use Y.js (Yjs) npm package and it works in npm start
but not npm run build
because Uglify doesn't support ES6. So I downloaded the release of that package and include it directly. But my reactjs npm run build
is still complaining about Uglify.
and my webpack.config.js
looks like this:
var path = require('path');
module.exports = {
entry: path.join(__dirname, 'public', 'quickstart.js'),
output: {
path: '/',
filename: 'bundle.js'
},
module: {
loaders: [
{
test: /.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ["react", "es2016", "stage-2"]
}
},
{ test: /\.css$/, loader: "style-loader!css-loader" }
]
}
}
How can I disable Uglify in my webpack? Which line determines that it has to Uglify in building process?
Edit:
{
"name": "myCoolApps",
"version": "0.1.0",
"private": true,
"devDependencies": {
"css-loader": "^0.26.1",
"react-scripts": "0.7.0",
"webpack": "^1.13.3"
},
"dependencies": {
"ace": "git+https://github.com/ajaxorg/ace.git#master",
"antd": "^2.7.2",
"axios": "^0.15.3",
"card": "^2.2.1",
"card-react": "^1.2.6",
"chat-template": "0.0.22",
"codemirror": "^5.25.0",
"credit-card-type": "^5.0.1",
"css-loader": "^0.26.1",
"d3": "^4.7.4",
"firechat": "^3.0.1",
"firepad": "^1.4.0",
"flux": "^3.1.0",
"gulp": "^3.9.1",
"gulp-sass": "^3.1.0",
"history": "^1.17.0",
"little-loader": "^0.2.0",
"lodash": "^4.17.4",
"material-ui": "^0.16.6",
"moment": "^2.17.1",
"node-sass": "^4.5.0",
"quill": "^1.2.3",
"rc-calendar": "^7.6.5",
"react": "^15.5.4",
"react-autosuggest": "^7.0.1",
"react-cookie": "^1.0.4",
"react-credit-card": "^0.20.0",
"react-dom": "^15.5.4",
"react-dropzone": "^3.8.0",
"react-event-timeline": "^1.2.2",
"react-infinite": "^0.10.0",
"react-infinite-scroller": "^1.0.7",
"react-list": "^0.8.3",
"react-notification-system": "^0.2.12",
"react-router": "^3.0.0",
"react-tap-event-plugin": "^2.0.1",
"seedrandom": "^2.4.2",
"simplewebrtc": "^2.2.2",
"style-loader": "^0.13.1",
"superagent": "^3.3.1",
"y-array": "^10.0.6",
"y-indexeddb": "^8.1.9",
"y-leveldb": "0.0.1",
"y-map": "^10.0.5",
"y-memory": "^8.0.8",
"y-richtext": "^9.0.8",
"y-text": "^9.3.2",
"y-webrtc": "^8.0.7",
"y-websockets-client": "^8.0.15",
"yjs": "^12.1.7"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
Actually yea I think it uses react-script. Is there anything I can do to alter that?
If you look at what npm run build
does, it actually runs another script, react-scripts build
. Your project is bootstrapped with create-react-app, correct?
As you can see in the package.json
, you also have access to a script called eject
.
Running npm run eject
will allow you to remove the app from the preconfigured workflow ( webpack
, babel
, etc ) and let you modify the workflow as you see fit.
With access to the configuration files, you can add, for example, the babel uglify plugin.
But be careful, there is a trade-off. As the docs mention
If your project needs more customization, you can "eject" and customize it, but then you will need to maintain this configuration.