Skip to content

Commit 879ea77

Browse files
Use Babel config babel.config.js format
1 parent cfa64f6 commit 879ea77

File tree

4 files changed

+30
-12
lines changed

4 files changed

+30
-12
lines changed
Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
1+
/**
2+
* Babel config
3+
*
4+
* @type {import('@babel/core').ConfigFunction}
5+
*/
16
module.exports = {
27
presets: [
3-
['@babel/preset-env', {
4-
corejs: '2',
5-
loose: true,
6-
shippedProposals: true,
7-
useBuiltIns: 'usage',
8-
}]
8+
[
9+
'@babel/preset-env',
10+
{
11+
corejs: '2',
12+
loose: true,
13+
shippedProposals: true,
14+
useBuiltIns: 'usage'
15+
}
16+
]
917
],
18+
1019
plugins: [
1120
['@babel/plugin-proposal-class-properties', { loose: true }],
1221
['@babel/plugin-proposal-decorators', { legacy: true }],
@@ -17,11 +26,10 @@ module.exports = {
1726
'@babel/plugin-transform-member-expression-literals',
1827
'@babel/plugin-transform-property-literals'
1928
],
29+
2030
env: {
2131
test: {
22-
plugins: [
23-
'istanbul'
24-
]
32+
plugins: ['istanbul']
2533
}
2634
}
27-
};
35+
}

test/karma.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
require('@babel/register')({
2-
cwd: require('path').resolve(__dirname, '../')
2+
rootMode: 'upward'
33
})
4+
45
var puppeteer = require('puppeteer')
56
var webpack = require('../webpack.config.babel.js')[0]
67

test/wdio.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
require('dotenv').config()
2+
require('@babel/register')({
3+
rootMode: 'upward'
4+
})
5+
26
const puppeteer = require('puppeteer')
37
const staticServerPort = process.env.PORT || 4567
48
const services = [

webpack.config.babel.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,12 @@ const config = {
6262
{
6363
test: /\.js$/,
6464
exclude: /node_modules/,
65-
loader: 'babel-loader'
65+
use: {
66+
loader: 'babel-loader',
67+
options: {
68+
rootMode: 'upward'
69+
}
70+
}
6671
}
6772
]
6873
},

0 commit comments

Comments
 (0)