-
Notifications
You must be signed in to change notification settings - Fork 14
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
Support dynamic imports for Vue components #6
Comments
Believe it or not, this actually makes sense since EDIT: I've got a proof-of-concept solution in v1.0.1-alpha.3. It requires adding |
- BabelMultiTargetPlugin.loader is now a method that accepts an optional webpack Loader - remove placeholder loader concept - consolidate/simplify babel-loader replacement logic supports #6
I've revamped the |
That's amazing! Thanks for your work to bring this plugin forward! v2.0.0-alpha.1 works for me for a simple vue-loader setup. However I'm getting errors when dynamically importing plain JS code from Vue components. I prepared another small example: https://github.com/rangermeier/webpack-babel-multi-target-plugin/tree/feature/example-vue-dynamic-import (please let me know if I should submit a PR for this, or should merge it with the vue-cssextract example) When a file is dynamically imported at two or more points in an application, there's an error |
- BabelMultiTargetPlugin.loader is now a method that accepts an optional webpack Loader - remove placeholder loader concept - consolidate/simplify babel-loader replacement logic supports #6
This one's a little trickier. I'm getting a two pairs of requests for the dependency file, I'm guessing because at that point, Webpack doesn't realize it's the same module (since I change the request when targeting). In other use cases, this generally indicates an error, as you can tell from the error being thrown. Looks like I might need to allow the same file to get blind targeted more than once. Also, thank YOU for working with me on this and helping me get Vue properly supported. I appreciate being able to check against someone with a real world use case rather than just trying to come up with a contrived example myself. |
… ES6 dynamic imports progress #6
Okay, some progress! v2.0.0-alpha.2 should work without using that However, when using the Update - fixed chunk naming in v2.0.0-alpha.3 |
v2.0.0-alpha.3 fixes the issue with dynamic imports, also named chunks are working for me now. However I encountered another problem with normal imports of npm modules, see #8 . Again, thank you for working on this plugin. |
So, a couple things: This wasn't actually an issue with the plugin - moment requires (ha!) a little finessing when used in an ES6 environment. I added a That said, it might be worth looking into using a different library like Luxon to get the most out of ES6 and things like tree shaking. Also, the syntax for using the module from |
Assuming there aren't any further issues, I'm going to close this and cut 2.0.0. |
Following up to the discussion in #4 I open a new issue for this.
v1.0.1-alpha.2 works fine for examples/es6-dynamic-import but for examples/vue-cssextract (the HelloWorld.vue component is loaded async) the output still looks like this:
When I import a plain js file dynamically from within a Vue component, webpack will however emit both a modern and a legacy chunk for it. E.g. adding another dependency.js and altering the component config of examples/vue-cssextract/App.vue like this:
will build the following files:
The text was updated successfully, but these errors were encountered: