Skip to content
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

[eval unsafe] fix build production only!! [urgent] #283

Merged
merged 4 commits into from
Feb 8, 2019
Merged

[eval unsafe] fix build production only!! [urgent] #283

merged 4 commits into from
Feb 8, 2019

Conversation

salvoravida
Copy link
Contributor

eval( ) problem on production!! csp unsafe

eval( ) problem on production!! csp unsafe
@johannwagner
Copy link

Is there a real reason, why you want to use the minified version? If you use a production ready toolchain, your toolchain will include and minify this in your build.

@salvoravida
Copy link
Contributor Author

no the only reason is that in 3.4.0 the NON min version is a DEV version with eval( ....
and if you are on a server with CSP that does not allow eval unsafe.eval all is broken!!

i think you shoud release in dist/ only PRODUCTION env code, min and non min version

@salvoravida
Copy link
Contributor Author

@johannwagner
Copy link

So, your proposed fix is a hotfix and not a correct fix.
You may want to look at #280, where an similar issue is described.

@JCKodel
Copy link

JCKodel commented Feb 7, 2019 via email

@salvoravida
Copy link
Contributor Author

i think you are missing the point.
dist/fuse.js is built in DEV MOE and is exported from package JSON -> main: "dist/fuse.js"
dist/fuse.min.js is bult in PROD mode but is NOT exported anyware.

ok?

i'm pushing a FULL fix to webpack.config.js
give me 5 minutes

@johannwagner
Copy link

I totally got your point.

I just wanted to point out, that it is not the solution to use the minified version, otherwise you will kill tree shaking for other users. You have to fix the non minifed build, this also should be production ready, because it is in the dist folder.

@salvoravida
Copy link
Contributor Author

@johannwagner see now. thanks

@salvoravida salvoravida changed the title fix build production only!! [eval unsafe] fix build production only!! Feb 7, 2019
@salvoravida salvoravida changed the title [eval unsafe] fix build production only!! [eval unsafe] fix build production only!! [urgent] Feb 7, 2019
@krisk krisk merged commit bf1c9fb into krisk:master Feb 8, 2019
krisk added a commit that referenced this pull request Feb 8, 2019
@krisk
Copy link
Owner

krisk commented Feb 8, 2019

Thanks for flagging. Broken behavior right now, even with this fix.

Originally, npm build was meant to build both the production (minified) and the development (full) version. Tangentially, #270 was caused by an unfortunate issue with the Webpack version I was using (mea culpa, frankly). Having since upgraded to Webpack 4, yet another problem had surfaced with the configuration. Turns out upgrading wasn't as straightforward. Also, current tests don't cover all cases. Could use some help there though 😄

i think you shoud release in dist/ only PRODUCTION env code, min and non min version

@salvoravida, in principle, sure. However, I think your change added --mode production to both. Note that Webpack v4+ will minify your code by default in production mode. Ergo, I think we still want the following:

"build": "webpack --mode development && webpack --mode production"

As @johannwagner pointed out:

...it is not the solution to use the minified version, otherwise you will kill tree shaking for other users. You have to fix the non minifed build, this also should be production ready, because it is in the dist folder.

To fix the original problem of those pesky evals, we can add devtool: false to webpack.config.js.

Sure, it also marginally slows down build time, but it's a fair trade.

@salvoravida thank you for catching this. It definitely escaped my eyes!

krisk added a commit that referenced this pull request Feb 8, 2019
krisk added a commit that referenced this pull request Feb 8, 2019
@salvoravida
Copy link
Contributor Author

thank you ! all is working now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants