github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/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: [
    18            'last 1 Chrome versions',
    19            'last 1 Firefox versions',
    20            'last 1 Safari versions',
    21          ],
    22        },
    23      ],
    24    ],
    25    plugins: [
    26      [
    27        '@babel/plugin-proposal-decorators',
    28        {
    29          legacy: true,
    30        },
    31      ],
    32      ['@babel/plugin-proposal-class-properties', { loose: true }],
    33      '@babel/plugin-syntax-dynamic-import',
    34      [
    35        '@babel/plugin-proposal-object-rest-spread',
    36        { loose: true, useBuiltIns: true },
    37      ],
    38      'babel-plugin-macros',
    39      ['emotion', { sourceMap: true, autoLabel: true }],
    40      [
    41        'babel-plugin-htmlbars-inline-precompile',
    42        {
    43          precompile: templateCompiler.precompile,
    44          modules: {
    45            'ember-cli-htmlbars': 'hbs',
    46            'ember-cli-htmlbars-inline-precompile': 'default',
    47            'htmlbars-inline-precompile': 'default',
    48          },
    49        },
    50        // This is an arbitrary label to prevent a collision with the existing htmlbars inline precompile
    51        // plugin that comes in from the @storybook/ember defaults.
    52        // TODO: After upgrading to Storybook 6.1 this should move into the new emberOptions construct.
    53        'override',
    54      ],
    55    ],
    56  };