We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
webpack.config
const path = require("path"), resolve = p => path.resolve(__dirname, p); const { WebPlugin, AutoWebPlugin } = require("web-webpack-plugin"); const config = { entry: { A: resolve("src/pages/A.js"), B: resolve("src/pages/B.js") }, output: { path: resolve("dist"), filename: "[name].js?[chunkhash]", publicPath:'v2/dist/' }, module: { loaders: [ { test: /\.css$/, use: ["style-loader", "css-loader"] } ] }, resolve: {}, plugins: [ new WebPlugin({ template:'./template.html', filename: "index.html", requires: ["A", "B"] }) ] }; module.exports = config;
template
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <script src="B"></script> <link rel="stylesheet" href="./reset.min.css?_inline"> <script src="./test.js"></script> </head> <body> <!-- SCRIPT --> </body> </html>
结果
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <style rel="stylesheet">*{ margin: 0; padding: 0; color: green; }</style> <script src="v2/dist/test.js"></script> </head> <body> <!-- SCRIPT --> </body> </html>
The text was updated successfully, but these errors were encountered:
应该是:
filename: "[name]_[chunkhash].js
详情请阅读 配置 Output
Sorry, something went wrong.
这个我知道 ,但是需求的是要在js文件后使用query形式的hash而不是修改文件名称
这个暂时还不支持
No branches or pull requests
webpack.config
template
结果
The text was updated successfully, but these errors were encountered: