In more complicated use cases it may prove difficult to ensure that the pattern matching for different attributes are mutually exclusive. To prevent confusion, the plugin operates a simple precedence model: if a script name matches theinlinescript matching pattern, it will be inlined; if a script...
config.when(process.env.NODE_ENV !== 'development', config => { config .plugin('ScriptExtHtmlWebpackPlugin') .after('html') .use('script-ext-html-webpack-plugin', [ { // `runtime` must same as runtimeChunk name. default is `runtime` inline: /runtime\..*\.js$/ } ]) .end(...
"inline", "script", "module", "resource hints", "prefetch", "preload", "dynamic script", "async script" ], "author": "Mike Evans <mike.evans@numical.com> (https://github.com/numical)", "license": "MIT", "css-loader": "^1.0.1", ...
new ScriptExtHtmlWebpackPlugin({ inline: /runtime\..*\.js$/ }), ], optimization: { runtimeChunk: true, // 构建出runtime~xx文件 splitChunks: { name: true, // 自动处理文件名 chunks: 'all', automaticNameDelimiter: '-', cacheGroups: { vendors: { test: /[\\/]node_modules[\\/]/...
inline: /runtime~.+\.js$/ //正则匹配runtime文件名 }) ] }, chainWebpack: config => { // set preserveWhitespace config.module .rule('vue') .use('vue-loader') .loader('vue-loader') .tap(options => { options.compilerOptions.preserveWhitespace = true ...
inline the code in the elements; add prefetch and preload resource hints for initial and dynamically loaded scripts. Installation You must be running webpack (1.x, 2.x, 3.x, 4.x) on node 6+. Install the plugin with npm: $ npm install --save-dev script-ext-html-webpack-plugin ...
if a script name matches theinline script matching pattern, it will be inlined; if a script name matches the sync script matching pattern, it will have no attribute, unless it matched condition 1; if a script name the async script matching pattern, it will have the async attribute...