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)
- Add support for $bitAnd (aggregation)
- Add support for $bitNot (aggregation)
- Add support $bitOr (aggregation)
- Add support for $bitXor (aggregation)
- updateObject fails when the $exists operator is used with $pull HOT 2
- $push with updateObject does not create the array if the fields does not exist HOT 1
- $inc with updateObject does not create the field if it doesn't exist HOT 1
- aggregate() $group stage with mongodb object id as group key only creates one single group HOT 1
- aggregate() $project stage modifies original collection when using negative projection on nested field HOT 2
- TypeError: Cannot convert undefined or null to object HOT 9
- AWS SSO HOT 2
- query HOT 1
- $project step omits referenced properties when matching property exists in incoming data HOT 3
- Basic query operators not loaded by default for update operation. HOT 4
- 6.4.11 regression: ESM imports no longer work HOT 4
- mingo.io is expired
- Minify compiled output for publishing
- Support value equality check for custom types using toString
- 6.4.14 regression: ESM imports no longer work HOT 3
- Are custom operators still a thing? HOT 1
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.