Comments (6)
Thanks for the report @ericfong
Can you please confirm if you get the same issues using the previous version 1.3.3
.
I want to confirm that this is due to porting to es6 and not because of moving the index.js
to the project root since the contents have barely changed.
from mingo.
There is tutorial here on how to use webpack with es6
http://ccoenraets.github.io/es6-tutorial/setup-webpack/
I think what needs to happen is that, you translate the files first with babel before passing it to uglify.
from mingo.
Thanks for your tutorial.
I confirm that
version 1.2.0
success
version 1.3.0
fail
I think the problem come from my webpack setting
exclude: /(node_modules|bower_components)/,
I am expecting that npm modules will export an es5 friendly release. (I am not sure that is a norm or not)
If I remove the exclude setting, babel will re-compile all node_modules. And some node_modules' .babelrc depend on some plugins that not installed
So far, I need to either manually blacklist or whitelist node_modules to transpile (which is too much work).
Do a little study about that and found
https://github.com/rollup/rollup/wiki/pkg.module#wait-it-just-means-import-and-export--not-other-future-javascript-features
Seems rollup suggest that when publishing es6 code, means transpile all es6 to es5 except import export
Following babel-preset-env setting may help:
"env": {
"module": {
"presets": [["env", { "targets": { "browsers": "> 1%" }, "useBuiltIns": true, "modules": false }]],
"plugins": [...],
},
"main": {
"presets": [["env", { "targets": { "uglify": true }, "useBuiltIns": true }]],
"plugins": [...],
},
},
from mingo.
Sounds like you found a nice workaround. I use rollup for mingo
and the distribution provides a compiled UMD-style version in dist/mingo.js
.
The approach you described appears to be the simplest. Library authors should be vending the es5 compiled versions along with the es6 sources so excluding node_modules
and setting modules: false
should work fine. I assume that will load the file at the main entry point which is the es5 version. https://github.com/kofrasa/mingo/blob/master/package.json#L5
See the file node_modules/mingo/dist/mingo.js
in your project environment.
from mingo.
I finally solved by installing webpack-babel-env-deps
which will include mingo into babel transpile process
Thanks
from mingo.
For those using webpack, you can just toss this into your setup, where config is your webpack configuration object. I'm using lodash here, but you get the idea!
_.set(
config,
'resolve.alias',
_.merge({}, _.get(config, 'resolve.alias', {}), {
mingo: 'mingo/dist/mingo.min.js',
})
);
from mingo.
Related Issues (20)
- How does generator function for collection work? HOT 2
- Expressions in arithmetic operators are evaluated in a nested path HOT 2
- Projection not working properly for deep nested objects HOT 1
- $Reduce $Map Returning incorrect results and making other fields return undefined.
- Es6 Module build HOT 1
- [email protected] breaks CommonJS requires of files inside package HOT 20
- Issues with $let since 6.2.0 HOT 1
- Strange behaviour in $round HOT 3
- Wrong evaluation with `NaN` value HOT 4
- TypeError: CreateListFromArrayLike called on non-object HOT 10
- Filter inside of map causes undefined variable item error
- Add support for `$linearFill` (aggregation window)
- Add support for $fill (aggregation)
- Add support for $densify (aggregation)
- $filter "truthy" condition returns incorrect results HOT 4
- Support useStrictMode for all truth value checks HOT 1
- Add support for $graphLookup (pipeline)
- aggregate() $sort stage on nested date replaces all items in collection with the last item (6.3.2) HOT 1
- $round is rounding down to even numbers even when it's above the .5 threshold HOT 4
- Regression in string matching in 4.3 HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mingo.