0

i trying to use react-toolbox with webpack 4 and react 16 but i have a problem loading react-toolbox dependences, they can not require prop-types, though it exist in node_modules: i getting the error:

https://monosnap.com/file/iUQAtohH4Zuv9uKeNSXqkJWG8IOZ5U

here is my webpack rules:

{
   test: /\.(js|jsx)$/,
   exclude: /node_modules/,
   loader: 'babel-loader'
},{
   // react-toolbox
   test: /\.css$/,
   include: Path.join(Config.node_modules, 'react-toolbox'),
   use: [
      {
         loader: 'css-loader',
         options: {
            modules: true,
            sourceMap: true,
            importLoaders: 1,
            localIdentName: '[name]--[local]--[hash:base64:8]'
         }
      },
      'postcss-loader'
   ]
},

my postcss.config.js:

module.exports = {
    plugins: {
        'postcss-cssnext': {
            features: {
                customProperties: {
                    variables: {
                        'animation-duration': '0.3s',
                        'color-primary': '#00a6ba',
                        'color-accent': 'var(--palette-pink-a200)',
                        'color-accent-dark': 'var(--palette-pink-700)',
                        'color-primary-contrast': 'var(--color-dark-contrast)',
                        'color-accent-contrast': 'var(--color-dark-contrast)',
                    }
                }
            }
        }
    }
};

my package.json:

    "prop-types": "15.6.2",
    "react": "16.8.6",
    "react-dom": "16.8.6",
    "react-intl": "2.9.0",
    "react-redux": "7.0.3",
    "react-router": "5.0.0",
    "react-router-dom": "5.0.0",
    "react-router-redux": "4.0.8",
    "react-toolbox": "^2.0.0-beta.13",

1 Answers1

0

I figure out what was the problem, it was webpack provider plugin, after I removed the prop-types from provider plugin every thing worked cool, but this affected other dependencies, so I need to remove classnames and react-intl as well.

it's stranger, because I load react with provider plugin and its work fine, but prop-types and another libraries that use prop-types get a error whem importing that.