Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/26.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
Javascript 从网页包包中排除特定文件_Javascript_Reactjs_Webpack_Bundle - Fatal编程技术网

Javascript 从网页包包中排除特定文件

Javascript 从网页包包中排除特定文件,javascript,reactjs,webpack,bundle,Javascript,Reactjs,Webpack,Bundle,在我的React应用程序中,我正在使用Webpack。这是我的webpack.config: "use strict"; var path = require("path"); var WebpackNotifierPlugin = require("webpack-notifier"); var BrowserSyncPlugin = require("browser-sync-webpack-plugin"); module.exports = { entry: "./Scrip

在我的React应用程序中,我正在使用Webpack。这是我的webpack.config:

"use strict";

var path = require("path");
var WebpackNotifierPlugin = require("webpack-notifier");
var BrowserSyncPlugin = require("browser-sync-webpack-plugin");

module.exports = {
    entry: "./Scripts/reactApp/index.jsx",
    output: {
        path: path.resolve(__dirname, "./Scripts/reactApp/build"),
        filename: "react_bundle.js"
    },
    module: {
        rules: [
            {
                test: /\.jsx$/,
                exclude: [/node_modules/, path.resolve(__dirname, "./Scripts/reactApp/translations/he.translations.json")],
                use: {
                    loader: "babel-loader"
                }
            },
            {
                test: /\.js$/,
                exclude: [/node_modules/, path.resolve(__dirname, "./Scripts/reactApp/translations/he.translations.json")],
                use: {
                    loader: "babel-loader"
                }
            }
        ]
    },
    devtool: "inline-source-map",
    plugins: [new WebpackNotifierPlugin(), new BrowserSyncPlugin()]
};
我试图从bundle
he.translations.json中排除
但这个网页包含了它

你能解释一下我做错了什么吗? 对不起,我是新来的。你可以(从)开始

路径中没有点,当然,假设您将wepback配置文件放在正确的位置。

您只需执行(从)

路径中没有点,当然,假设您在正确的位置有wepback配置文件

...
exclude: [/node_modules/, path.resolve(__dirname, 'Scripts/reactApp/translations/he.translations.json')],
...