-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.common.js
41 lines (39 loc) · 1.27 KB
/
webpack.common.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
38
39
40
41
const path = require('path');
const fs = require('fs');
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const Dotenv = require('dotenv-webpack');
// App directory
const appDirectory = fs.realpathSync(process.cwd());
module.exports = {
entry: path.resolve(appDirectory, "src/controllers"),
output: {
filename: 'index.js',
path: path.resolve(__dirname, 'public/dist')
},
resolve: {
extensions: ['.ts', '.js']
},
module: {
rules: [
{
test: /\.(js|mjs|jsx|ts|tsx)$/,
loader: 'source-map-loader',
enforce: 'pre',
},
{
test: /\.tsx?$/,
loader: 'ts-loader'
}
]
},
plugins: [
new CleanWebpackPlugin(),
new Dotenv({
safe: true, // load '.env.example' to verify the '.env' variables are all set. Can also be a string to a different file.
systemvars: true, // load all the predefined 'process.env' variables which will trump anything local per dotenv specs.,
defaults: true // load '.env.defaults' as the default values if empty.
})
],
}