-1

I'm trying to configurate webpack but I stuck because of this error. I think the problem is with entry. But when i try to add it without path: like in tutorial i get "(property) path: path.PlatformPath" ',' expected

 const webpack = require('webpack')
    const path = require('path');
    
    const CopyWebpackPlugin = require('copy-webpack-plugin')
    const MiniCssExtractPlugin = require('mini-css-extract-plugin')
    
    const IS_DEVELOPMENT = process.env.NODE_ENV === 'dev'
    
    const dirApp = path.join(__dirname, 'app')
    const dirAssets = path.join(__dirname, 'assets')
    const dirStyles = path.join(__dirname, 'styles')
    const dirNode = 'node_modules'
    
    module.exports = {
        entry: {
           path: path.join(dirApp, 'index.js'),
           path: path.join(dirStyles, 'index.scss'),
        },
    
        resolve: {
            modules: {
                dirApp,
                dirAssets,
                dirStyles,
                dirNode
            }
        }
    }

I get this error

[webpack-cli] Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
 - configuration.resolve.modules should be an array:
   object { alias?, aliasFields?, byDependency?, cache?, cachePredicate?, cacheWithContext?, conditionNames?, descriptionFiles?, enforceExtension?, exportsFields?, extensionAlias?, extensions?, 
fallback?, fileSystem?, fullySpecified?, importsFields?, mainFields?, mainFiles?, modules?, plugins?, preferAbsolute?, preferRelative?, resolver?, restrictions?, roots?, symlinks?, unsafeCache?, useSyncFileSystemCalls? }
   -> Folder names or directory paths where to find modules.
Kuniooo
  • 34
  • 6

1 Answers1

1

Your resolve.modules is Object, but should be Array. Check here for docs.

Animir
  • 1,121
  • 10
  • 23