js-to-styles-var-loader
js-to-styles-var-loader copied to clipboard
Require is undefined importing in to a less file
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.
Is the path correct (../globals/colors.js)?
Thanks for your reply yes it is.
On Wed, 24 Apr 2019 5:36 am Tamas G. Toth, [email protected] wrote:
Is the path is correct (../globals/colors.js)?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tompascall/js-to-styles-var-loader/issues/8#issuecomment-485944360, or mute the thread https://github.com/notifications/unsubscribe-auth/AAOT4CSF4VSYFIK7TCGFUTTPR5QL7ANCNFSM4HHU4JZA .
when i @import from ‘.less’ in a less file, it not work
@WilkinWendy could you insert the error message you get? Would be nice to have more info about environment where the error occurs.
@tompascall i mean less allows us to @import a .less file in a less file ,in webpack this is handled by less-loader,. My problem is if try to load js-variables in a less file which is imported by another less file, the error occurs.