Javascript 错误:找不到模块';提取文本网页包插件';
我已经在terminalJavascript 错误:找不到模块';提取文本网页包插件';,javascript,webpack,webpack-style-loader,Javascript,Webpack,Webpack Style Loader,我已经在terminalsudo npm install-g extract text webpack plugin中使用此命令安装了extract text webpack plugin,并导入到webpack.config.js文件中,但仍然收到了错误 我也提到了这个问题,但没有找到任何解决方案,所以我发布了新的问题 Webpack.config.js文件源代码: /* Custom Config */ var ProgramID = '1111'; /* Default Config
sudo npm install-g extract text webpack plugin
中使用此命令安装了extract text webpack plugin,并导入到webpack.config.js文件中,但仍然收到了错误
我也提到了这个问题,但没有找到任何解决方案,所以我发布了新的问题
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安装-保存提取文本网页包插件
您已经为root用户安装了它,但不是全局安装的。添加-g标志以在项目目录中安装或创建带有npm init
的package.json,然后执行npm安装--保存提取文本网页包插件