-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sometimes gatsby build
doesn't minify the commons-*.js file
#2877
Comments
See my post here, maybe it helps #2771 |
@sebastienfi ah, thanks a lot! I can close this as a duplicate then. |
Reopening this to post my solution.
exports.modifyWebpackConfig = ({ config, stage }) => {
if (stage === 'build-javascript') {
// Temporary workaround.
// Here we override the Webpack plugin during the `build-javascript` stage to make everything
// compile down to es5 - turns out Webpack 1's UglifyJsPlugin doesn't like that we have some
// ES6 stuff littered in our final bundle...
config.loader('typescript', {
test: /\.tsx?$/,
loaders: ['ts-loader']
})
}
}
{
"compilerOptions": {
"outDir": "./dist/",
"sourceMap": true,
"noImplicitAny": true,
"module": "commonjs",
"target": "es5",
"jsx": "react",
"lib": ["dom", "esnext"]
},
"include": [
"./src/**/*"
]
} |
I tried to follow the advice from @resir014's post, but I kept getting So, I found the proper solution for me, and maybe this could help others in the future. In the plugin section of
|
@Cammisuli Please update |
gatsby 1.9.106
,gatsby-cli 1.1.20
I've brought up this issue on the Reactiflux chat the other day, but I'm going to put it as an issue here since it's potentially an issue on both Gatsby and Netlify.
On some occasions,
gatsby build
doesn't generate a minifiedcommons-*.js
file:This could sometimes result in the React Devtools saying that I'm not running a minified build of React whenever I deploy to Netlify with Continuous Deployment:
Running
gatsby build
and manually deploying everything to Netlify will cause React Devtools to behave, however the resultingcommons-*.js
file remains unminified.The text was updated successfully, but these errors were encountered: