generated from wednesday-solutions/nodejs-hapi-template
-
Notifications
You must be signed in to change notification settings - Fork 29
/
babel.config.js
37 lines (34 loc) · 931 Bytes
/
babel.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
module.exports = function(api) {
api.cache(true); // Caches the computed configuration
const presets = ['@babel/preset-env', '@babel/preset-flow'];
const plugins = [
'@babel/plugin-proposal-throw-expressions',
'@babel/plugin-proposal-class-properties',
'@babel/transform-runtime'
];
// Environment-specific configuration
const env = process.env.BABEL_ENV || process.env.NODE_ENV;
if (env !== 'test') {
plugins.push([
'module-resolver',
{
root: ['./src'],
alias: {
'@server': './server',
'@root': '',
'@utils': './server/utils',
'@middleware': './server/middleware',
'@services': './server/services',
'@daos': './server/daos',
'@database': './server/database',
'@gql': './server/gql',
'@config': './config'
}
}
]);
}
return {
presets,
plugins
};
};