How to use the babel-loader.apply function in babel-loader

To help you get started, we’ve selected a few babel-loader examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Jordaneisenburger / fallback-studio / src / pwa-studio / packages / pwa-buildpack / src / magento-layout-loader / index.js View on Github external
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);
};
github mrsharpoblunto / it-gets-the-hose-again / web / babel-loader.js View on Github external
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;
        }
    }
};

babel-loader

babel module loader for webpack

MIT
Latest version published 11 months ago

Package Health Score

91 / 100
Full package analysis