Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Webpack 无法将插件添加到网页包配置文件_Webpack_Ecmascript 6_Webpack 2_Webpack 4_Html Webpack Plugin - Fatal编程技术网

Webpack 无法将插件添加到网页包配置文件

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 =

我正在尝试将用于生成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 = {}; // 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添加时,它会抱怨没有入口点,但我没有任何入口点,我只希望文件在公用文件夹中生成。 有人能解释一下吗?我遗漏了什么吗