错误:找不到模块“webpack" [英] Error: Cannot find module 'webpack'

查看:51
本文介绍了错误:找不到模块“webpack"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始使用 webpack,并且很难获得 多入口- 点样本来构建.示例中的 webpack.config.js 文件包含一行

I'm just getting started with webpack and am having difficulty getting the multiple-entry-points sample to build. The webpack.config.js file in the example includes the line

 var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin");

我因错误而失败

Error: Cannot find module '../../lib/optimize/CommonsChunkPlugin'

四处搜索,我发现了使用 CommonsChunkPlugin 和表达式的其他示例

Searching around, I found other examples of using the CommonsChunkPlugin with the expression

var commonsPlugin = new webpack.optimize.CommonsChunkPlugin("common.js");

由于错误而失败

ReferenceError: webpack is not defined

更多的搜索发现了一些例子,包括

Some more searching found a number of examples including

var webpack = require('webpack');

我的构建现在失败了

Error: Cannot find module 'webpack'

我不知道如何进行.

推荐答案

将全局安装的包链接到您的项目:

Link globally installed package to your project:

npm link webpack

查看yarn link的官方文档代码>.

这篇关于错误:找不到模块“webpack"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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