Webpack - extract-text-webpack-plugin无法找到模块 [英] Webpack - extract-text-webpack-plugin Cannot find module

查看:234
本文介绍了Webpack - extract-text-webpack-plugin无法找到模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

webpack.config.js

var ExtractTextPlugin = require("extract-text-webpack-plugin");

如果我只是实现插件,我会立即收到此错误:

I immediately receive this error if I just implement the plugin:

module.js:339
    throw err;
    ^

Error: Cannot find module 'webpack/lib/ConcatSource'
    at Function.Module._resolveFilename (module.js:337:15)
    at Function.Module._load (module.js:287:25)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (/Users/lucamormile/Documents/Lavori/Webapps/React/webpack_test/node_modules/extract-text-webpack-plugin/index.js:5:20)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)

我忘记了什么?

推荐答案

你有 webpack 项目上的模块?

如果没有,请在本地安装(不是全局):

Do you have webpack module on your project?
If not, install it locally (not globally):

$ npm install webpack [--save-dev]

extract-text-webpack -plugin 需要 webpack 作为对等依赖项,但是npm 3不会自动安装对等依赖项。

extract-text-webpack-plugin needs webpack as peer dependency, but npm 3 doesn't install peer dependencies automatically.

这篇关于Webpack - extract-text-webpack-plugin无法找到模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆