Parcel: How to achieve automatic vendor splitting?

Created on 29 Mar 2018  路  3Comments  路  Source: parcel-bundler/parcel

So I wanted to separate modules (and polyfills) from node_modules but the current state of Parcel doesn't really seem to do that...What if we could make the main app scripts separated like main.<hash>.js, vendor.<hash>.js and polyfill.<hash>.js? Thank you.

Question RFC

Most helpful comment

I'll close this down as it's a duplicate/related and centralised discussion is always better

All 3 comments

Indeed we could use something like:

const React, {Component} = import("react")

Yet it is smelly in terms of code and strays away from ES Standard. Definitely no good.

Edit: nope it doesn't work.

There is an RFC for this: #885. To make your code work you'd need to use await somewhere in an async function, or Promise.then :

const React, {Component} = await import("react")

I'll close this down as it's a duplicate/related and centralised discussion is always better

Was this page helpful?
0 / 5 - 0 ratings