How to use babel-plugin-import - 2 common examples

To help you get started, we’ve selected a few babel-plugin-import 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 senntyou / lila / old / project_config / webpack / loaders / babel_loader.js View on Github external
module.exports = config => {
  const presets = config.babelLoaderPresets || [];
  presets.unshift(stage0Preset);
  presets.unshift(es2015Preset);
  if (config.flow) presets.push(flowPreset);

  const plugins = config.babelLoaderPlugins || [];
  plugins.unshift([importPlugin.default, config.import || []]);
  plugins.unshift(transformReactJsx);
  if (config.flowRuntime) plugins.push([flowRuntimePlugin.default, { assert: !0, annotate: !0 }]);

  const loader = {
    loader: 'babel-loader',
    test: /\.(js|jsx)$/,
    options: {
      presets,
      plugins,
    },
  };

  config.babelLoaderExclude && (loader.exclude = config.babelLoaderExclude);

  return loader;
};
github RubyLouvre / anu / packages / cli / parsers / jsParser / H5Parser.js View on Github external
constructor(props) {
        super(props);
        this._babelPlugin = {
            configFile: false,
            babelrc: false,
            comments: false,
            ast: true,
            plugins: [
                [
                    require('@babel/plugin-syntax-class-properties'),
                    { loose: true }
                ],
                require('@babel/plugin-proposal-object-rest-spread'),
                [
                    require('babel-plugin-import').default,
                    {
                        libraryName: 'schnee-ui',
                        libraryDirectory: 'components',
                        camel2DashComponentName: false
                    }
                ],
                require('@babel/plugin-syntax-jsx'),
                require('../../packages/babelPlugins/transformIfImport'),
                require('../../packages/babelPlugins/h5/transformH5')
            ]
        };
        if (this.componentType === 'App') {
            this._babelPlugin.plugins.push(require('../../packages/babelPlugins/h5/transformH5App'));
        }
        else if (this.componentType === 'Page') {
            this._babelPlugin.plugins.push(require('../../packages/babelPlugins/h5/transformH5Page'));

babel-plugin-import

Component modular import plugin for babel.

MIT
Latest version published 1 year ago

Package Health Score

65 / 100
Full package analysis

Popular babel-plugin-import functions