Webpack missingmodule无法找到模块“scripts / build.js”

时间:2017-11-24 14:42:18

标签: javascript webpack

我已经将webpack作为dev依赖项安装并设置了webpack.config.js。

webpack.config.js文件的内容

const path = require('path');

module.exports = {
    entry: './scripts/test.js',
    output: {
        path: path.resolve(__dirname, 'scripts'),
        filename: 'build.js'
    }
};

由于某些原因,它会抛出以下错误

build.js:10431 Uncaught Error: Cannot find module "scripts/build.js"
    at webpackMissingModule (build.js:10431)
    at Object.<anonymous> (build.js:10431)
    at __webpack_require__ (build.js:10372)
    at build.js:10415
    at Object.<anonymous> (build.js:10418)
    at __webpack_require__ (build.js:20)
    at Object.<anonymous> (build.js:86)
    at __webpack_require__ (build.js:20)
    at Object.defineProperty.value (build.js:63)
    at build.js:66

我能知道这是什么问题吗?

test.js文件的内容是

console.log("testing");

我使用的命令;

./node_modules/webpack/bin/webpack.js ./scripts/test.js ./scripts/build.js

0 个答案:

没有答案