webpack 4 執行 webpack hello.js hello.bundle.js 報錯
webpack 4 執行 webpack hello.js hello.bundle.js
報錯:
ERROR in multi ./hello.js hello.bundle.js
Module not found: Error: Can't resolve in 'hello.bundle.js' in 'F:\git\webpack-demo'
@ multi ./hello.js hello.bundle.js
webpack 4如何在命令行中執行 hello.js 打包到hello.bundle.js?
2018-03-20
webpack 4 之后這個命令已經不行,需要命令行指明output-filename 和 output-path
npx webpack hello.js --output-filename hello.bundle.js --output-path . --mode development?
2019-08-13
非常感謝
2019-03-13
視頻講的是webpack3.0的版本,可能你本地的是webpack4.0的版本,webpack hello.js hello.bundle.js 這個執行語句在4.0中已經不能用了,所以你要使用npx webpack hello.js --output-filename hello.bundle.js --output-path . --mode development?
2018-12-18
好了,就是不知道如何重新打包的命令是什么。。。。 再次打包就報錯了。不過只看到第一節,后面應該會講到。
2018-03-20
我嘗試了很多,都報錯,不過可以安裝版本就可以了
2018-03-20
很可能路徑錯了
pageage.json
{ ??"name":?"webpack4", ??"version":?"1.0.0", ??"description":?"", ??"main":?"index.js", ??"scripts":?{ ????"test":?"echo?\"Error:?no?test?specified\"?&&?exit?1", ????"build":?"webpack?--mode?production", ????"dev":?"webpack?--mode?development" ??}, ??"author":?"", ??"license":?"ISC", ??"dependencies":?{ ????"webpack":?"^4.1.1" ??}, ??"devDependencies":?{ ????"webpack-cli":?"^2.0.12" ??} }webpack.config.js
const?path?=?require('path'); module.exports?=?{ entry:?'./src/javascript/index.js', output:?{ filename:?'bundle.js', path:?path.resolve(__dirname,'dist') } }文件目錄