Webpack4 + splitChunks + multiple portals, how to achieve the common code in the public folder, the entry public code in the portal folder?

problem description

my application is a multi-page application. The entry is
src/a/index.js
src/b/index.js

.

a pages are packaged into a.js
b pages and packaged into b.js
, where entrances an and b have common codes x.js
a, common codes x-a.js
b, common codes x-b.js

I now want to achieve the effect of output as follows
build/x.js

build/a/a.js
build/a/x-a.js

build/b/b.js
build/b/x-b.sj

the description of the problem is abstract. Do you understand it? Is it feasible?


is certainly possible, and can be achieved by customizing plug-ins.
but it doesn't make much sense, because the generated file itself is not managed by us, and we don't really need to know how it was generated.

Menu