Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/23.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 Webpack4不仅仅是从内存中绑定服务_Javascript_Reactjs_Webpack - Fatal编程技术网

Javascript Webpack4不仅仅是从内存中绑定服务

Javascript Webpack4不仅仅是从内存中绑定服务,javascript,reactjs,webpack,Javascript,Reactjs,Webpack,我在使用wp4时遇到了问题,昨天我做了一些构建,但现在在删除dist文件夹后,它开始通过使用缓存或内存服务而不是创建文件来解决这个问题 我的应用程序结构是: -根文件夹 -公开的 -src 在这里配置 我的网页包配置: //const MiniCssExtractPlugin = require("mini-css-extract-plugin") const ExtractTextPlugin = require('extract-text-webpack-plugin') const Htm

我在使用wp4时遇到了问题,昨天我做了一些构建,但现在在删除dist文件夹后,它开始通过使用缓存或内存服务而不是创建文件来解决这个问题

我的应用程序结构是: -根文件夹 -公开的 -src 在这里配置

我的网页包配置:

//const MiniCssExtractPlugin = require("mini-css-extract-plugin")
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const HtmlWebpackPlugin = require("html-webpack-plugin");
const path = require('path')

console.log("Bundling the application..")

module.exports = {

  watch: true,

  target: 'web',

  entry: './src/index.js',


  output: {
    path: path.resolve(__dirname, 'build'),
    publicPath: '',
    filename: 'bundle.js'
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        loader: "babel-loader",
        query: {
          presets: ['react', 'es2015', 'env'],
          plugins: ['transform-class-properties']
        }
      },
      {
        test: /\.css$/,
        loader: ExtractTextPlugin.extract({
          loader: 'css-loader',
          options: {
            modules: true,
            minimize: true
          }
        })
      },
      /*{
        test: /\.css$/,
        use: [
          {
            loader: MiniCssExtractPlugin.loader,
            options: {
              // you can specify a publicPath here
              // by default it use publicPath in webpackOptions.output
              publicPath: '',
              modules: true
            }
          },
          "css-loader"
        ]
      },*/
      {
        test: /\.(woff(2)?|ttf|png|jpg|gif|svg)$/,
        loader: 'file-loader',
        /*loader: "file-loader?name=/img/[name].[ext]", */
        query: {
            name: '[name].[ext]?[hash]'
        }
      }
    ]
  },

  plugins: [
    new ExtractTextPlugin({
        filename: 'web.css',
        disable: false,
        allChunks: true
    }),
    /*new MiniCssExtractPlugin({
      // Options similar to the same options in webpackOptions.output
      // both options are optional
      filename: "[name].css",
      chunkFilename: "[id].css"
    }),*/
    new HtmlWebpackPlugin({
      title: "Track on Performance",
      template: "./public/index.html",
      filename: "index.html"
    })
  ],

  resolve: {
    extensions: ['.js', '.json', '.jsx']
  },

  devServer: {
    port: 3000,
    watchContentBase: true,
    compress: true
  }
};

我在控制台上没有错误,您也可以,我尝试了mini css extract,但问题仍然存在

您如何运行命令?有一些区别取决于你是如何开始的。是的,我发现,我在运行webpack服务器,但现在我发现一年后,我需要做webpack-w