@wxa/compiler-babel
wxa babel compiler
Last updated a month ago by genuifx .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @wxa/compiler-babel 
SYNC missed versions from official npm registry.

wxa-compiler-babel

babel 编译器, 用于将 ESnext 语法转义到 ES5,以便运行在小程序平台中。

Install

npm i -D @wxa/compiler-babel

Usage

使用默认配置

// wxa.config.js
module.exports = {
    use: ['babel'],
}

指定 babel 配置

// wxa.config.js
module.exports = {
    use: [{
        name: 'babel',
        test: /\.js$|\.wxs$/,
        options: {
            "sourceMap": false,
            "presets": ["@babel/preset-env"],
            "plugins": [
                ["@babel/plugin-transform-runtime", {"corejs": false, "version": "7.1.2"}],
                ["@babel/plugin-proposal-decorators", {"decoratorsBeforeExport": true}],
                ["@babel/plugin-proposal-class-properties"]
            ],
            "ignore": [
                "node_modules"
            ]
        }
    }],
}

在指定 options 的情况下,会优先使用 options 的 babel 配置中,否则会尝试读取项目根目录的 .babelrcbabel.config.js 文件。

使用 Typscript 开发

安装 @babel/preset-typescript 后,修改一下配置即可:

// wxa.config.js
module.exports = {
    use: [{
        name: 'babel',
        test: /\.js$|\.wxs$/,
        options: {
            "sourceMap": false,
            "presets": ["@babel/preset-env", "@babel/preset-typescript"],
            "plugins": [
                ["@babel/plugin-transform-runtime", {"corejs": false, "version": "7.1.2"}],
                ["@babel/plugin-proposal-decorators", {"decoratorsBeforeExport": true}],
                ["@babel/plugin-proposal-class-properties"]
            ],
            "ignore": [
                "node_modules"
            ]
        }
    }],
}

Current Tags

  • 1.1.0-beta.9141af0e                                ...           beta (a year ago)
  • 2.0.7                                ...           latest (a month ago)
  • 2.2.0-alpha.7                                ...           next (11 days ago)

51 Versions

  • 2.2.0-alpha.7                                ...           11 days ago
  • 2.0.7                                ...           a month ago
  • 2.1.0-alpha.1                                ...           2 months ago
  • 2.1.0-alpha.0                                ...           2 months ago
  • 2.0.6                                ...           4 months ago
  • 2.0.0                                ...           8 months ago
  • 2.0.0-rc.1                                ...           8 months ago
  • 2.0.0-rc.0                                ...           8 months ago
  • 2.0.0-rc.92                                ...           8 months ago
  • 2.0.0-beta.aec5f80c                                ...           9 months ago
  • 2.0.0-beta.70255b65                                ...           9 months ago
  • 2.0.0-beta.7d9ff778                                ...           10 months ago
  • 2.0.0-beta.9fc0c988                                ...           10 months ago
  • 2.0.0-beta.020496bf                                ...           10 months ago
  • 2.0.0-beta.7f8e3efb                                ...           10 months ago
  • 2.0.0-beta.27b29004                                ...           10 months ago
  • 2.0.0-beta.554b0d79                                ...           10 months ago
  • 2.0.0-beta.6ef105fd                                ...           10 months ago
  • 2.0.0-alpha.9516c8c4                                ...           10 months ago
  • 2.0.0-alpha.0df9e28a                                ...           10 months ago
  • 2.0.0-alpha.262e667b                                ...           10 months ago
  • 2.0.0-alpha.360df434                                ...           a year ago
  • 2.0.0-alpha.8cd52c5d                                ...           a year ago
  • 2.0.0-alpha.e7e06c46                                ...           a year ago
  • 2.0.0-alpha.2b5e0ad7                                ...           a year ago
  • 2.0.0-alpha.f2138c48                                ...           a year ago
  • 2.0.0-alpha.5f705829                                ...           a year ago
  • 2.0.0-alpha.d435cb13                                ...           a year ago
  • 1.1.3                                ...           a year ago
  • 1.1.1 [deprecated]           ...           a year ago
  • 1.1.0                                ...           a year ago
  • 1.1.0-beta.9141af0e                                ...           a year ago
  • 1.1.0-beta.5b33a7a3                                ...           a year ago
  • 1.1.0-beta.92b9c417                                ...           a year ago
  • 1.1.0-beta.679942ae                                ...           a year ago
  • 1.1.0-beta.d6cf041d                                ...           a year ago
  • 1.1.0-beta.47a08615                                ...           a year ago
  • 1.1.0-beta.a6cc2d89                                ...           a year ago
  • 1.1.0-beta.05fbb8d9                                ...           a year ago
  • 1.1.0-beta.6fbe2fbd                                ...           a year ago
  • 1.1.0-beta.a93231b6                                ...           a year ago
  • 1.1.0-beta.84703713                                ...           a year ago
  • 1.1.0-beta.c319b649                                ...           a year ago
  • 1.1.0-beta.53cd590f                                ...           a year ago
  • 1.0.5-beta-1                                ...           a year ago
  • 1.0.5-beta                                ...           a year ago
  • 1.0.4                                ...           a year ago
  • 1.0.3                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 79
Last Day 0
Last Week 2
Last Month 31
Dependencies (5)
Dev Dependencies (3)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |