D
D
Denis2018-02-19 15:26:12
webpack
Denis, 2018-02-19 15:26:12

Getting an error when building a project with Webpack?

Hello. I recently installed Webpack 3.11.0 , it changed the connection of loaders, etc., accordingly. Nevertheless, based on the documentation, I registered in the conf. webpack file all the relevant rules, in particular for Babel. Error while building:
ERROR in ./src/index.js
Module build failed: Error: Couldn't find preset "preset-env" relative to directory "C:\\git-repo\\todos"
at C:\git -repo\todos\node_modules\babel-core\lib\transformation\file\options\option-manager.js:293:19
at Array.map ()
at OptionManager.resolvePresets (C:\git-repo\todos\node_modules\ babel-core\lib\transformation\file\options\option-manager.js:275:20)
at OptionManager.mergePresets (C:\git-repo\todos\node_modules\babel-core\lib\transformation\file\options\option-manager.js:264:10)
at OptionManager.mergeOptions (C:\git-repo\ todos\node_modules\babel-core\lib\transformation\file\options\option-manager.js:249:14)
at OptionManager.init (C:\git-repo\todos\node_modules\babel-core\lib\transformation\ file\options\option-manager.js:368:12)
at File.initOptions (C:\git-repo\todos\node_modules\babel-core\lib\transformation\file\index.js:212:65)
at new File (C:\git-repo\todos\node_modules\babel-core\lib\transformation\file\index.js:135:24)
at Pipeline.transform (C:\git-repo\todos\node_modules\babel-core \lib\transformation\pipeline.js:46:16)
at transpile (C:\git-repo\todos\node_modules\babel-loader\lib\index.js:50:20)
@ multi (webpack)-dev-server/client? localhost:8080 webpack/hot/dev-server ./src/index.js
webpack: Failed to compile.
The presets seem to be indicated in the babelrc. I can't figure out what he's complaining about. There is a link to the github with the project. Help to understand, please. https://github.com/denis862008/test

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2018-02-19
@den0820

Correct in .babelrc :

{
  "presets": ["env", "react", "stage-0"],
  "plugins": ["transform-decorators-legacy"]
}

and remove from config. No need to duplicate.
Or fix it in the config:
options: {
  presets: ['env', 'react', 'stage-0'],
  plugins: ['transform-decorators-legacy']
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question