Comments (9)
@wmm387 @KnisterPeter this plugin is for node, not for webpack - we have https://github.com/airbnb/babel-plugin-dynamic-import-webpack for webpack 1 and 2, and webpack 3+ understands this syntax natively.
from babel-plugin-dynamic-import-node.
I also have this problem.
from babel-plugin-dynamic-import-node.
Me too. Downgrading fixes this.
from babel-plugin-dynamic-import-node.
Same here, should be downgraded to 2.3.0
from babel-plugin-dynamic-import-node.
The created output here is something like this:
Promise.resolve('prefix-${var}').then(s => require(s))
If this is check by webpack, it results in unmatched dynamic imports.
Webpack could understand require('prefix-${var}')
but not require(s)
The fix for #84 need to be reverted and fixed in another way.
from babel-plugin-dynamic-import-node.
cc @nicolo-ribaudo we may have to revert to the original, but still evaluate the result twice so as to evaluate it sync?
from babel-plugin-dynamic-import-node.
@ljharb Thanks for the hint
from babel-plugin-dynamic-import-node.
cc @nicolo-ribaudo we may have to revert to the original, but still evaluate the result twice so as to evaluate it sync?
Evaluating twice is worse than evaluating asynchronously. Also, it would bring back the bug that originally led to that PR (yield
or await
inside import arguments).
If the dynamic import argument is a single StringLiteral
, we could transpile it to
Promise.resolve().then(s => require("./module"))
in more complex cases where it would be observable, I think that it is better to do the correct thing rather than trying to adapt the output to webpack, which doesn't need this plugin in the first place.
from babel-plugin-dynamic-import-node.
That seems totally reasonable.
from babel-plugin-dynamic-import-node.
Related Issues (20)
- Inconsistency with Webpack v4 HOT 16
- Version 10 of node.js has been released
- vulnerabilities found via npm install HOT 1
- Error Unknown plugin "dynamic-import-node" specified in "base" at 1, HOT 16
- Repository out of sync with published version in npm? HOT 3
- `babel-plugin-syntax-dynamic-import` vs `babel-plugin-dynamic-import-node` HOT 4
- Update to Babel 7 HOT 3
- Version 2.1.0 not on npm HOT 6
- Bring the file suffix name, the compilation result cannot be executed HOT 2
- An in-range update of eslint-plugin-import is breaking the build 🚨 HOT 2
- missing support for query params and fragments HOT 3
- No description in github releases HOT 1
- how to compile to one file HOT 3
- An in-range update of eslint-plugin-import is breaking the build 🚨 HOT 3
- `import()` argument shouldn't be evaluated in the arrow scope HOT 6
- v2.3.1 introduced a breaking change HOT 1
- Variables in dynamic imports broken after 2.3.0 HOT 2
- How should we deal with module attributes? HOT 1
- Specifier should not be resolved HOT 2
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 babel-plugin-dynamic-import-node.