/record-entry-plugin

record the list of entry files in the json file

Primary LanguageJavaScriptMIT LicenseMIT

NPM version License

record-entry-plugin

After the build, plugin record the entry point of the project。This way, you can leave the webpack runtime code and request the chunks in the correct order.

install

npm install record-entry-plugin --save-dev

use

// At the end, the file name of the entry file record is `${publicPath}+${fileName}.json`, PublicPath reads webpack configuration publicPath
new recordEntryPlugin({
  fileName: 'chunks'
});

The contents of chunks.json

when the config of webpack is :

  entry: path.resolve(__dirname, `../src/index.js`),

content of chunk.json :

  {"main":["/main.6097c34ccf96ffa3b783.js"]}

when the config of webpack is :

  entry: {
    design: path.resolve(__dirname, `../src/design/index.js`),
    runtime: path.resolve(__dirname, `../src/runtime/index.js`)
  }

content of chunk.json :

{
  "design": ["/design.b7b434d9ea6818c7e822.js"],
  "runtime": [
    "/css/runtime.0826353e91956fa5d041.css",
    "/runtime.662c683e4ed914a7e798.js"
  ]
}

License

The record-entry-plugin is MIT licensed.