-
-
Notifications
You must be signed in to change notification settings - Fork 65
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
Failed to minify the code from this file: defs.js #89
Comments
So it seems that uglifyJS, which is what I guess a unpleasant side effect of this issue, which is still unanswered - will there ever be a npm release with a consumable module? - I see it's just a matter of doing |
It's actually a bit more complex - the target should be |
Definitely not. I consider build artifacts in a repository to be a huge mistake.
This doesn't seem to match with your earlier statement (about retaining es6 modules in the pre-compiled file)
Yes.
A release of this fengari repository will not include a compiled module (however end-user intended projects such as fengari-web probably will): fengari should be given to your existing bundler which may perform e.g. tree shaking.
Why? Which tool does not support commonjs style modules? |
And I agree. But the only way to do that without an npm package is including
Sorry about my confusing statement: What I meant is that:
But until there is, there's no way to use
Fengari can't be given to my existing bundler, because UglifyJS (which is the de facto standard in javascript uglifying) needs compiled code. Also, as in before, distributing uncompiled code is considered bad practice, at least by the Facebook and UglifyJS developers. |
fengari-web uses fengari with webpack.
New uglifyJs supports es6. https://www.npmjs.com/package/uglify-es
In that case, I disagree with them.
|
AFAIK, fengari-web loads scripts directly from the DOM, while I need to programatically run scripts typed in a textarea. The only Lua code in the project would be input by the user, in other words.
Don't want to start a compiler war here, but compiling ES6 to ES5 seems to be the de-facto way of distributing a library. You are free to disagree, of course, but that would make the library more difficult to use for FE developers who use |
fengari-web does that by watching for script tags added to the dom and running the lua code it finds in them. https://github.com/fengari-lua/fengari-web/blob/master/src/fengari-web.js Instead of doing that, you could write something that runs code when user hits "submit" or such.
I myself use webpack out of the box without issues. |
I had the same problems with boilerplate generated by vue-cli:
I fixed this by adding a separate Webpack loader rule for fengari (rule order may matter): {
test: /.js$/,
loader: 'babel-loader',
include: [resolve('node_modules/fengari/src')],
options: {
babelrc: false,
presets: ['env']
}
}
I'm not very familiar with |
Yep, I can eject the I was wondering whether it was possible to use fengari with It seems it's not possible, so I'll fall back to writing additional code to support Fengari in my project. |
It works, indeed. It's when it comes to minifying and source-mapping for production that UglifyJS dies. Right or wrong, it's pretty much what all the major Javascript libraries do. They have their |
Closing this. |
This file is failing minification with react-create-app.
Their docs say:
Did you have this kind of problem before? Why is it failing? Seems a pretty "normal" js file to me.
The text was updated successfully, but these errors were encountered: