小编sta*_*uck的帖子

webpack报错:__diranme is not defined

我是 NodeJS 和 webpack 的新手。

我正在关注 webpack 的教程,何时必须创建 webpack.config.js 并运行webpack -c webpack.config.js它返回:

webpack -c webpack.config.js

/home/arma/bin/nodejs/webpack.config.js:15
        root: path.join(__diranme, './src'),
                        ^
ReferenceError: __diranme is not defined
    at Object.<anonymous> (/home/arma/bin/nodejs/webpack.config.js:15:25)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at module.exports (/usr/lib/node_modules/webpack/bin/convert-argv.js:80:13)
    at Object.<anonymous> (/usr/lib/node_modules/webpack/bin/webpack.js:39:40)
    at Module._compile (module.js:456:26)
Run Code Online (Sandbox Code Playgroud)

我的 webpack.config.js:

var path = require('path');

module.exports = {
    context: __dirname,
    entry: [
        './src/index.js',
    ],
    output: {
        path: path.join(__dirname, 'build'),
        filename: 'output.js',
        publicPath: …
Run Code Online (Sandbox Code Playgroud)

javascript dirname node.js webpack

-2
推荐指数
1
解决办法
7953
查看次数

标签 统计

dirname ×1

javascript ×1

node.js ×1

webpack ×1