Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const query = {
babelrc: false,
plugins: [dynamicImportSyntax, [babelPlugin, babelPluginConfig]]
};
// Yuck. babel-loader reads options from the webpack loader's
// `this.query` property (through loader-utils). We need to set this property
// to pass through options, but webpack has a `getter` without a `setter`
// so we can't just mutate `this.query`. Instead of the mutation,
// we create a new object with the proto pointed at the current `this`,
// and just shadow the `query` prop
const shadowThis = Object.create(this, {
query: { value: query }
});
return babelLoader.apply(shadowThis, args);
};
module.exports = function() {
try {
return loader.apply(this, [].slice.call(arguments));
} catch (err) {
if (err._babel && err instanceof SyntaxError) {
throw new Error(err.message + '\n' + err.codeFrame);
} else {
throw err;
}
}
};