-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
Hi John! π
I ran into an error cannot read property 'noParse' of undefined after upgrading to webpack 3. It seems that this.options.module is now undefined π’ . Looking over the docs on webpack loaders (https://webpack.js.org/contribute/writing-a-loader/) it seems they discourage accessing the options directly, and they even go so far as to say that options is read-only.
I was able to get things working by explicitly adding the noParse rule to my config:
noParse: /i18nliner\/dist\/lib\/i18nliner/,
and creating a simpler version of your webpack loader that doesn't set the noParse config anymore:
const I18nliner = require('i18nliner').default;
const hasTranslatableText = require('react-i18nliner/hasTranslatableText')(I18nliner.config);
const preprocess = require('react-i18nliner/preprocess');
module.exports = function i18nloader(source) {
this.cacheable();
if (hasTranslatableText(source)) {
return preprocess(source, I18nliner.config);
}
return source;
};I'm not sure if there's still a way to automatically set the noParse config from within the loader.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels