Recently i came across web pack dynamic import here, and manage to import via Template literals using webpackChunkName, following an answer from this link.
Due to the js file that i'm importing is an app project itself, it contains the node_modules packages and some other source code files, thus webpack is packaging everything during build.
How should i only include the build folder only in my import using webpackInclude and regular expression?
Here is my import code
let entry = 'main.js'
let appName = 'app1'
import(
/* webpackInclude : ./apps/*/dist */
`./apps/${appName}/dist/${entry}`
)
Here is my folder structure in brief
|-- apps
|-- app1
|-- dist
|-- main.js
|-- node_modules
|-- src
|-- package.json
|-- webpack.config.js
|-- app.js
|-- package.json
|-- webpack.config.js
The import code is at app.js, would need help to correct ./apps/*/dist
to a correct regular expression