mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-09 13:26:10 +00:00
69dd8c5b89
Allow for embark sources to be authored in TypeScript and/or JavaScript, and to make use of upcoming features of the JS language. Sources in the src/ directory are transpiled into the dist/ directory, and npm-scripts are provided to support and automate various aspect of the build process. Source map support is enabled at runtime, i.e. when invoking the embark cli and running embark's test suite.
49 lines
995 B
JavaScript
49 lines
995 B
JavaScript
/* global module */
|
|
|
|
module.exports = function (api) {
|
|
const node = {
|
|
ignore: [
|
|
'src/lib/modules/pipeline/babel-loader-overrides.js',
|
|
'src/lib/modules/pipeline/webpack.config.js'
|
|
],
|
|
plugins: [
|
|
'babel-plugin-macros',
|
|
[
|
|
'@babel/plugin-proposal-decorators', {
|
|
legacy: true
|
|
}
|
|
],
|
|
'@babel/plugin-syntax-dynamic-import',
|
|
'babel-plugin-dynamic-import-node',
|
|
[
|
|
'@babel/plugin-proposal-class-properties', {
|
|
loose: true
|
|
}
|
|
],
|
|
'@babel/plugin-proposal-optional-chaining',
|
|
[
|
|
'@babel/plugin-transform-runtime', {
|
|
corejs: 2
|
|
}
|
|
]
|
|
],
|
|
presets: [
|
|
[
|
|
'@babel/preset-env', {
|
|
targets: {
|
|
node: '8.11.3'
|
|
}
|
|
}
|
|
],
|
|
'@babel/preset-typescript'
|
|
]
|
|
};
|
|
|
|
switch (api.env()) {
|
|
case 'node':
|
|
return node;
|
|
default:
|
|
throw new Error(`invalid babel env: ${api.env}`);
|
|
}
|
|
};
|