gpt4 book ai didi

javascript - 错误: Cannot find module 'extract-text-webpack-plugin'

转载 作者:行者123 更新时间:2023-12-02 14:37:35 34 4
gpt4 key购买 nike

我已经在终端中使用此命令安装了 extract-text-webpack-plugin sudo npm install -g extract-text-webpack-plugin 并导入到 webpack.config.js 文件中,仍然我收到错误。

我也提到了这个问题,但没有找到任何解决方案,所以我发布了新问题。

Webpack - extract-text-webpack-plugin Cannot find module

Webpack.config.js文件源代码:

/* Custom Config */
var ProgramID = '1111';

/* Default Config */
var webpack = require('webpack');
var path = require('path');
var polyfill = require("babel-polyfill");
var ExtractTextPlugin = require("extract-text-webpack-plugin");

var BUILD_DIR = path.resolve(__dirname, 'build/Programs/' + ProgramID);
var APP_DIR = path.resolve(__dirname, 'src/import');

module.exports = {
entry: [
'babel-polyfill',
'webpack-dev-server/client?http://localhost:8080/',
APP_DIR + '/import.js'
],
output: {
path: BUILD_DIR + '/',
filename: '/js/bundle.js',
publicPath: '../Programs/' + ProgramID
},
module: {
loaders: [{
test: /\.jsx?$/,
loaders: ['react-hot', 'babel?presets[]=es2015,presets[]=react,plugins[]=transform-runtime'],
exclude: /node_modules/
}, {
test: /\.css$/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader")
}, {
test: /\.scss$/,
loaders: ["style", "css", "sass"]
}, {
test: /\.(png|woff|woff2|eot|ttf|svg|jpg|gif)$/,
loader: 'file-loader?name=/images/[name].[ext]'
}]
},
plugins: [
new ExtractTextPlugin("style.css"),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
],
process: function(path, filename) {
if (filename.indexOf('node_modules') === -1) {
path = babelJest.process(path, filename);
path = webpackAlias.process(path, filename);
}
return path;
},
externals: {
"jquery": "jQuery"
}
};

最佳答案

您已经为root安装了它,但没有全局安装。添加 -g 标志以在项目目录中使用 npm init 安装或创建 package.json,然后执行 npm install --save extract-text-webpack-plugin

关于javascript - 错误: Cannot find module 'extract-text-webpack-plugin' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37301361/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com