Webpack 无法将插件添加到网页包配置文件
我正在尝试将用于生成robots.txt的插件添加到我的项目中: 以下是我当前的网页配置设置:Webpack 无法将插件添加到网页包配置文件,webpack,ecmascript-6,webpack-2,webpack-4,html-webpack-plugin,Webpack,Ecmascript 6,Webpack 2,Webpack 4,Html Webpack Plugin,我正在尝试将用于生成robots.txt的插件添加到我的项目中: 以下是我当前的网页配置设置: var path = require("path"); var DIST_DIR = path.resolve(__dirname, "public"); var SRC_DIR = path.resolve(__dirname, "src"); const RobotstxtPlugin = require("robotstxt-webpack-plugin"); const options =
var path = require("path");
var DIST_DIR = path.resolve(__dirname, "public");
var SRC_DIR = path.resolve(__dirname, "src");
const RobotstxtPlugin = require("robotstxt-webpack-plugin");
const options = {}; // see options below
var config = {
//entry: [ SRC_DIR + "/app/index.js"],
entry: [ SRC_DIR + "/app/client.js"],
output: {
path: DIST_DIR ,
filename: "bundle.js"
},
module: {
loaders: [
{
test: /\.js?/,
include: SRC_DIR,
loader: "babel-loader",
query: {
"plugins": ["transform-decorators-legacy", "transform-class-properties","transform-decorators"],
presets: [
"react",
"es2015",
"stage-2",
['env', {targets: {browsers: ['last 3 versions']}}]]
}
}, {
test: /\.s?css/,
include: SRC_DIR,
loaders: ["style-loader","css-loader","sass-loader"]
},
{ test: /\.(svg|woff|ttf|wav|mp3)$/, loader: "file-loader" },
{
test: /\.(png|jpe?g|gif)$/,
loader: 'url-loader?limit=25000&name=img/[name].[ext]'
}
]
}
};
现在我需要将robotstxt网页包插件添加到这个网页包配置中。问题是我需要它在公用文件夹中创建robots.txt,但我没有任何入口点
module.exports = {
plugins: [new RobotstxtPlugin(options)]
};
当我将其作为单独的module.export添加时,它会抱怨没有入口点,但我没有任何入口点,我只希望文件在公用文件夹中生成。
有人能解释一下吗?我遗漏了什么吗