我正在创建一个npm包,并使用webpack作为加载器,如babel、eslint等。然而,我的假设是,打包后的最终版本应该只包含一个模块,不包括webpackBootstrap。
这是我当前的包、webpack配置和源代码。我简化了它,只是为了让它“工作”。
我检查它是否有效的步骤:
npm install
npm run build
npm install -g .
node
var test = require('test-package');
导致此错误:
Error: Cannot find module 'test-package'
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 repl:1:12
at REPLServer.defaultEval (repl.js:248:27)
at bound (domain.js:280:14)
at REPLServer.runBound [as eval] (domain.js:293:12)
at REPLServer.<anonymous> (repl.js:412:12)
at emitOne (events.js:82:20)
我刚开始学习使用webpack和npm,如果您需要更多信息,请告诉我。
npm link
呢?顺便说一下,我已经在我的样板文件中解决了这些问题。如果你有时间研究它的方法,它会为你做很多事情。 - Juho Vepsäläinen