Na aula "Babel-loader, a ponte entre o Webpack e o Babel" quando executo o comando "npm run build-dev" me aparecer a seguinte mensagem de erro.
ERROR in ./app-src/app.js
Module build failed: Error: Couldn't find preset "es2017" relative to directory "C:\\Users\\u110401\\Documents\\Node\\WebPack\\projeto-webpack\\client"
at C:\Users\u110401\Documents\Node\WebPack\projeto-webpack\client\node_modules\babel-core\lib\transformation\file\options\option-manager.js:293:19
at Array.map (native)
at OptionManager.resolvePresets (C:\Users\u110401\Documents\Node\WebPack\projeto-webpack\client\node_modules\babel-core\lib\transformation\file\options\option-manager.js:275:20)
at OptionManager.mergePresets (C:\Users\u110401\Documents\Node\WebPack\projeto-webpack\client\node_modules\babel-core\lib\transformation\file\options\option-manager.js:264:10)
at OptionManager.mergeOptions (C:\Users\u110401\Documents\Node\WebPack\projeto-webpack\client\node_modules\babel-core\lib\transformation\file\options\option-manager.js:249:14)
at OptionManager.init (C:\Users\u110401\Documents\Node\WebPack\projeto-webpack\client\node_modules\babel-core\lib\transformation\file\options\option-manager.js:368:12)
at File.initOptions (C:\Users\u110401\Documents\Node\WebPack\projeto-webpack\client\node_modules\babel-core\lib\transformation\file\index.js:212:65)
at new File (C:\Users\u110401\Documents\Node\WebPack\projeto-webpack\client\node_modules\babel-core\lib\transformation\file\index.js:135:24)
at Pipeline.transform (C:\Users\u110401\Documents\Node\WebPack\projeto-webpack\client\node_modules\babel-core\lib\transformation\pipeline.js:46:16)
at transpile (C:\Users\u110401\Documents\Node\WebPack\projeto-webpack\client\node_modules\babel-loader\lib\index.js:49:20)
at Object.module.exports (C:\Users\u110401\Documents\Node\WebPack\projeto-webpack\client\node_modules\babel-loader\lib\index.js:171:20)
Meu código
Babelrc
{
"presets":["es2017"],
"plugins" : ["transform-decorators-legacy"]
}
package
{
"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"
}
}
webpack.config
const path = require('path');
module.exports = {
entry: './app-src/app.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use : {
loader: 'babel-loader'
}
}
]
}
}
Tentei corrigir mas não obtive sucesso. Alguém tem ideia do problema?