0.15.1 • Published 4 years ago

@arters/babel-preset-app v0.15.1

Weekly downloads
40
License
-
Repository
-
Last release
4 years ago

@arters/babel-preset-app

This package includes the full Babel preset for SPA, isomorphic app and npm-lib.

Installation

npm install --save-dev @arters/babel-preset-app

Aliases

  • @api resolves to ./src/api/
  • @features resolves to ./src/features/
  • @lib resolves to ./src/lib/
  • @pages resolves to ./src/pages/
  • @ui resolves to ./src/ui/

Usage

Then create a file named .babelrc with following contents in the root folder of your project:

{
  "presets": ["@arters/app"]
}

Effector Integration

Babel plugin with description.

plugins: [
  ['effector/babel-plugin', { addLoc: true }][
    ('effector/babel-plugin',
    {
      importName: '@your/pkg',
      storeCreators: ['createInputField'],
      eventCreators: [],
      effectCreators: [],
      domainCreators: [],
    })
  ],
]

Эта запись означает, что при использовании метода createInputField из пакета @your/pkg, в него вторым аргументом будет передаваться объект {name, sid}.

Usage for Isomorphic App

You can also use the ssr option on .babelrc:

{
  "presets": [["@arters/app", { "ssr": true }]]
}

Usage with TypeScript

Make sure you have a tsconfig.json file at the root directory. You can also use the typescript option on .babelrc:

{
  "presets": [["@arters/app", { "typescript": true }]]
}

Read the Babel config docs for more information.