webpack-encore icon indicating copy to clipboard operation
webpack-encore copied to clipboard

Webpack virtual module supports

Open pupaxxo opened this issue 4 years ago • 2 comments

Hi,

the stimulus-bridge plugin make use of webpack-virutal-module plugin to dynamically compile new modules according to the defined controllers.json file. Would it make sense to extend and prepare something to dynamically load entries from a json file?

Something like this

# webpack.config.js

Encore
  .addDynamicEntries('assets/pages.json')
# pages.json

{
  "entries": {
    "security_login": "./assets/pages/security/login.js",
    "security_register": "./assets/pages/security/register.js"
  }
}

We have a lot of page-specific entries and always adding it to the webpack configuration (with the need of restart it every time) is becoming a mess.

What do you think?

pupaxxo avatar Jan 02 '21 19:01 pupaxxo

That's an interesting idea! I am open to it if someone wants to submit a pull request :).

weaverryan avatar Jan 09 '21 19:01 weaverryan