我使用的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