js-to-styles-var-loader icon indicating copy to clipboard operation
js-to-styles-var-loader copied to clipboard

Require is undefined importing in to a less file

Open owlyowl opened this issue 5 years ago • 5 comments

const getThemeConfig = (extractLess, themeNameToPassInToLess) => { return { test: /\.(css|less)$/, use: extractLess.extract({ use: [ { loader: "css-loader", options: { importLoaders: 1 } }, 'postcss-loader', { loader: "less-loader", options: { plugins: [ lessPlugins ], globalVars: { themeName: themeNameToPassInToLess, customThemeColor: '#0000ff' } } }, { loader: "js-to-styles-var-loader" } ], fallback: "style-loader" }) }; };

I have this as my less config but then at the top of a random less file I've included: require('../globals/colors.js');

Unfortunately I'm getting required is undefined.

owlyowl avatar Apr 23 '19 06:04 owlyowl