github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/ui/.storybook/babel.config.js (about)

     1  /* eslint-env node */
     2  
     3  // Inject the named blocks polyfill into the template compiler (and then into the babel plugin)
     4  const templateCompiler = require('ember-source/dist/ember-template-compiler');
     5  const namedBlocksPolyfillPlugin = require('ember-named-blocks-polyfill/lib/named-blocks-polyfill-plugin');
     6  
     7  templateCompiler.registerPlugin('ast', namedBlocksPolyfillPlugin);
     8  
     9  module.exports = {
    10    presets: [
    11      [
    12        '@babel/preset-env',
    13        {
    14          shippedProposals: true,
    15          useBuiltIns: 'usage',
    16          corejs: '3',
    17          targets: ['last 1 Chrome versions', 'last 1 Firefox versions', 'last 1 Safari versions'],
    18        },
    19      ],
    20    ],
    21    plugins: [
    22      [
    23        '@babel/plugin-proposal-decorators',
    24        {
    25          legacy: true,
    26        },
    27      ],
    28      ['@babel/plugin-proposal-class-properties', { loose: true }],
    29      '@babel/plugin-syntax-dynamic-import',
    30      ['@babel/plugin-proposal-object-rest-spread', { loose: true, useBuiltIns: true }],
    31      'babel-plugin-macros',
    32      ['emotion', { sourceMap: true, autoLabel: true }],
    33      [
    34        'babel-plugin-htmlbars-inline-precompile',
    35        {
    36          precompile: templateCompiler.precompile,
    37          modules: {
    38            'ember-cli-htmlbars': 'hbs',
    39            'ember-cli-htmlbars-inline-precompile': 'default',
    40            'htmlbars-inline-precompile': 'default',
    41          },
    42        },
    43        // This is an arbitrary label to prevent a collision with the existing htmlbars inline precompile
    44        // plugin that comes in from the @storybook/ember defaults.
    45        // TODO: After upgrading to Storybook 6.1 this should move into the new emberOptions construct.
    46        'override',
    47      ],
    48    ],
    49  };