Giter Site home page Giter Site logo

fis-parser-babel-6.x's Introduction

fis-parser-babel-6.x

插件默认开启了 preset-2015 preset-stage-3 preset-react,如果希望使用更多的babel插件,可以使用插件配置自行添加

插件配置文档可以参考 https://babeljs.io/docs/usage/api/#options

FIS2用法

fis.config.set('project.fileType.text', 'es');
fis.config.set('modules.parser.es', 'babel-6.x');
fis.config.set('roadmap.ext.es', 'js');

FIS3用法

fis.set('project.fileType.text', 'es');
fis.match('server/**.es', {
    parser: fis.plugin('babel-6.x', {
        // presets: [
        // 注意一旦这里在这里添加了 presets 配置,则会覆盖默认加载的 preset-2015 等插件,因此需要自行添加所有需要使用的 presets
        // ]
    }),
    rExt: 'js'
});

如何开启resourcemap

以下例子以 FIS3 为示例,FIS2可参考调整

fis.match('server/**.es', {
    parser: fis.plugin('babel-6.x', {
        sourceMaps: true
    }),
    rExt: 'js'
});

如果使用的是 FIS2 ,为了保证 sourcemap 的功能正常,请确认 FIS2 版本 > 1.9.3

FIS2 下如何只为 *.es.js 开启Babel编译

fis.config.set('modules.parser.js', 'babel-6.x');
fis.config.set('settings.parser.babel-6.x');

fis.config.get('roadmap.path').unshift({
    reg: '**.es.js',
    useBabel: true  // 开启 Babel 编译,可以忽略
}, {
    reg: '**.js',
    useBabel: false // 关闭 Babel 编译
});

DEMO

https://github.com/fex-team/fis3-demo/tree/master/use-react

fis-parser-babel-6.x's People

Contributors

hefangshi avatar greenkeeperio-bot avatar g8up avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.