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.
Hi John! 馃憢
I ran into an error
cannot read property 'noParse' of undefinedafter upgrading to webpack 3. It seems thatthis.options.moduleis 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
noParserule to my config:noParse: /i18nliner\/dist\/lib\/i18nliner/,and creating a simpler version of your webpack loader that doesn't set the
noParseconfig anymore:I'm not sure if there's still a way to automatically set the
noParseconfig from within the loader.