我使用的WebPack HTML插件生成从graphiql.ejs HTML页面,但它不是生成HTML页面,当我运行npm start
的WebPack HTML插件未生成HTML
webpack.config.js
var HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
plugins: [
new HtmlWebpackPlugin({
filename: "public/graphql/index.html", // Write the file to <public-path>/graphql/index.html
inject: false, // Do not inject any of your project assets into the template
GRAPHQL_VERSION: packageJSON.dependencies.graphql.replace(/[^0-9.]/g, ""), // Get the graphql version from my package.json
template: "graphiql.ejs" // path to template
})
]
};
我想在/ public/graphql目录中生成index.html。有谁知道我做错了什么?有没有其他命令来运行webpack?
你需要把它放到'plugins'阵列和导出https://webpack.github.io/docs/using:这会自动当你做
start
脚本npm start
(more details)前执行-plugins.html – serge1peshcoff@ serge1peshcoff我做了https://pastebin.com/1NgiM3kY但仍然没有生成 –
您的'npm start'脚本是否运行'webpack.config.js'文件? – Jehy