Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Error: 'output.filename' is required, either in config file or as --output-filename

Oi pessoal. Não consigo achar onde errei... entendi que falta o output.filename no config. Mas ele esta lá... me parece que o arquivo não esta sendo encontrado, mas conferi o caminho também... ou não entendi algo.

Tentando debugar o convert-argv.js, mas alguém de fora pode ver algo diferente. Agradeço a ajuda.

Erro:

$ npm run build-dev

> client@1.0.0 build-dev E:\_lab\projeto-webpack\client
> webpack --config webpack.config.js

E:\_lab\projeto-webpack\client\node_modules\webpack\bin\convert-argv.js:487
                                throw new Error("'output.filename' is required, either in config file or as --output-filename");
                                ^

Error: 'output.filename' is required, either in config file or as --output-filename
    at processOptions (E:\_lab\projeto-webpack\client\node_modules\webpack\bin\convert-argv.js:487:11)
    at processConfiguredOptions (E:\_lab\projeto-webpack\client\node_modules\webpack\bin\convert-argv.js:136:4)
    at module.exports (E:\_lab\projeto-webpack\client\node_modules\webpack\bin\convert-argv.js:112:10)
    at Object.<anonymous> (E:\_lab\projeto-webpack\client\node_modules\webpack\bin\webpack.js:155:40)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! client@1.0.0 build-dev: `webpack --config webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the client@1.0.0 build-dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\racarvalho\AppData\Roaming\npm-cache\_logs\2021-01-19T12_00_08_092Z-debug.log

webpack.config.js

const path = require('path');

module.export = './app-src/app.js',
    output: {
        filename: 'bundle.js',
        path: path.resolve(__dirname, 'dist')
    },
    modules: {
        rules: [
            {
                test: /\.js$/,
                exclude: /node_modules/,
                use: {
                    loader: 'babel-loader'
                }
            }
        ]
    }
}

package.josn

{
  "name": "client",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "build-dev": "webpack --config webpack.config.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "reflect-metadata": "^0.1.10"
  },
  "devDependencies": {
    "babel-core": "^6.25.0",
    "babel-loader": "^7.1.0",
    "babel-plugin-transform-decorators-legacy": "^1.3.4",
    "babel-preset-es2017": "^6.24.1",
    "webpack": "^3.1.0"
  }
}
1 resposta
solução!

Pessoa... achei...

Estou usando

module.export

e o correto é com 's' no final.

module.exports

quem nunca! hehe