A
A
Alexander2017-02-02 15:52:22
webpack
Alexander, 2017-02-02 15:52:22

How to fix this webpack error?

I started taking a webpack course https://learn.javascript.ru/screencast/webpack
I took the first example. I run the webpack command in the console, it gives the following error

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.resolve has an unknown property 'modulesDirectories'. These properties are valid:
   object { alias?, aliasFields?, cachePredicate?, descriptionFiles?, enforceExtension?, enforceModuleExtension?, extensions?, fileSystem?, mainFields?, mainFiles?, moduleExtensions?, modules?, plugins?, resolver?, symlinks?, unsafeCache?, useSyncFileSystemCalls? }
 - configuration.resolve.extensions[0] should not be empty.
 - configuration.resolveLoader has an unknown property 'moduleTemplates'. These properties are valid:
   object { alias?, aliasFields?, cachePredicate?, descriptionFiles?, enforceExtension?, enforceModuleExtension?, extensions?, fileSystem?, mainFields?, mainFiles?, moduleExtensions?, modules?, plugins?, resolver?, symlinks?, unsafeCache?, useSyncFileSystemCalls? }
 - configuration.resolveLoader.extensions[0] should not be empty.

I decided to install the old version of Webpack (1.8), but the following error appeared.
ERROR in ./home.js
Module build failed: ReferenceError: [BABEL] /var/www/training.ru/frontend/home.js: Using removed Babel 5 option: base.optional - Put the specific transforms you want in the `plugins` option
    at Logger.error (/var/www/training.ru/node_modules/babel-core/lib/transformation/file/logger.js:41:11)
    at OptionManager.mergeOptions (/var/www/training.ru/node_modules/babel-core/lib/transformation/file/options/option-manager.js:220:20)
    at OptionManager.init (/var/www/training.ru/node_modules/babel-core/lib/transformation/file/options/option-manager.js:367:12)
    at File.initOptions (/var/www/training.ru/node_modules/babel-core/lib/transformation/file/index.js:216:65)
    at new File (/var/www/training.ru/node_modules/babel-core/lib/transformation/file/index.js:139:24)
    at Pipeline.transform (/var/www/training.ru/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
    at transpile (/var/www/training.ru/node_modules/babel-loader/lib/index.js:38:20)
    at Object.module.exports (/var/www/training.ru/node_modules/babel-loader/lib/index.js:133:12)

ERROR in ./about.js
Module build failed: ReferenceError: [BABEL] /var/www/training.ru/frontend/about.js: Using removed Babel 5 option: base.optional - Put the specific transforms you want in the `plugins` option
    at Logger.error (/var/www/training.ru/node_modules/babel-core/lib/transformation/file/logger.js:41:11)
    at OptionManager.mergeOptions (/var/www/training.ru/node_modules/babel-core/lib/transformation/file/options/option-manager.js:220:20)
    at OptionManager.init (/var/www/training.ru/node_modules/babel-core/lib/transformation/file/options/option-manager.js:367:12)
    at File.initOptions (/var/www/training.ru/node_modules/babel-core/lib/transformation/file/index.js:216:65)
    at new File (/var/www/training.ru/node_modules/babel-core/lib/transformation/file/index.js:139:24)
    at Pipeline.transform (/var/www/training.ru/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
    at transpile (/var/www/training.ru/node_modules/babel-loader/lib/index.js:38:20)
    at Object.module.exports (/var/www/training.ru/node_modules/babel-loader/lib/index.js:133:12)

ERROR in ./common.js
Module build failed: ReferenceError: [BABEL] /var/www/training.ru/frontend/common.js: Using removed Babel 5 option: base.optional - Put the specific transforms you want in the `plugins` option
    at Logger.error (/var/www/training.ru/node_modules/babel-core/lib/transformation/file/logger.js:41:11)
    at OptionManager.mergeOptions (/var/www/training.ru/node_modules/babel-core/lib/transformation/file/options/option-manager.js:220:20)
    at OptionManager.init (/var/www/training.ru/node_modules/babel-core/lib/transformation/file/options/option-manager.js:367:12)
    at File.initOptions (/var/www/training.ru/node_modules/babel-core/lib/transformation/file/index.js:216:65)
    at new File (/var/www/training.ru/node_modules/babel-core/lib/transformation/file/index.js:139:24)
    at Pipeline.transform (/var/www/training.ru/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
    at transpile (/var/www/training.ru/node_modules/babel-loader/lib/index.js:38:20)
    at Object.module.exports (/var/www/training.ru/node_modules/babel-loader/lib/index.js:133:12)

What to do? How to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2017-02-02
@Dredder

The second error went away after installing an older version of babelnpm -i [email protected]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question