Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MRW#02 Configuração do Webpack #595

Closed
biaaPrado opened this issue Nov 30, 2022 · 1 comment
Closed

MRW#02 Configuração do Webpack #595

biaaPrado opened this issue Nov 30, 2022 · 1 comment
Labels

Comments

@biaaPrado
Copy link

biaaPrado commented Nov 30, 2022

Instalei os pacotes corretamente, mas ao rodar o comando webpack, aparece o seguinte erro

webpack
/home/bia/react-webpack/webpack.config.js:6
    entry: path.join(_dirname, 'src', 'index'),
                     ^

ReferenceError: _dirname is not defined
    at Object.<anonymous> (/home/bia/react-webpack/webpack.config.js:6:22)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at module.exports (/home/bia/.npm-global/lib/node_modules/webpack/bin/convert-argv.js:80:13)
    at Object.<anonymous> (/home/bia/.npm-global/lib/node_modules/webpack/bin/webpack.js:39:40)
    at Module._compile (internal/modules/cjs/loader.js:999:30)

Comparando o arquivo webpack.config.js está identico ao mostrado na aula

'use strict'

const path = require('path')

module.exports = {
    entry: path.join(_dirname, 'src', 'index'),
    output:{
        path: path.join(_dirname, 'dist'),
        filename: 'bundle.js'
    }
}

@fdaciuk

@fdaciuk
Copy link
Member

fdaciuk commented Nov 30, 2022

Oi @biaaPrado! Essa variável começa com dois underlines: __dirname =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants