-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
65 lines (62 loc) · 3.48 KB
/
Copy pathwebpack.config.js
File metadata and controls
65 lines (62 loc) · 3.48 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import "dotenv/config"; // Load environment variables from .env file
import path from "path";
import CopyWebpackPlugin from 'copy-webpack-plugin';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export default (env, argv) => {
const mode = argv.mode || process.env.APP_ENV || 'production';
return {
mode: mode,
entry: {},
output: {
path: path.resolve(__dirname, 'public/')
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
}
]
},
plugins: [
new CopyWebpackPlugin({
patterns: [
{ from: './node_modules/bootstrap/dist/css/*.css', to: 'bootstrap/css/[name][ext]' },
{ from: './node_modules/bootstrap/dist/js/*.js', to: 'bootstrap/js/[name][ext]' },
{ from: './node_modules/bootstrap-datepicker/dist/css/*.css', to: 'bootstrap/css/[name][ext]' },
{ from: './node_modules/bootstrap-datepicker/dist/js/*.js', to: 'bootstrap/js/[name][ext]' },
{ from: './node_modules/@fortawesome/fontawesome-free/css/*.css', to: 'assets/fontawesome/css/[name][ext]' },
{ from: './node_modules/@fortawesome/fontawesome-free/js/*.js', to: 'assets/fontawesome/js/[name][ext]' },
{ from: './node_modules/print-js/dist/*.css', to: 'assets/printjs/css/[name][ext]' },
{ from: './node_modules/print-js/dist/*.js', to: 'assets/printjs/js/[name][ext]' },
{ from: './node_modules/select2/dist/css/*.css', to: 'bootstrap/css/[name][ext]' },
{ from: './node_modules/select2/dist/js/*.js', to: 'bootstrap/js/[name][ext]' },
{ from: './node_modules/toastr/build/*.css', to: 'assets/toastr/css/[name][ext]' },
{ from: './node_modules/toastr/build/*.js', to: 'assets/toastr/js/[name][ext]' },
{ from: './node_modules/chart.js/dist/*.js', to: 'assets/charts/js/[name][ext]' },
{ from: './node_modules/sweetalert2/dist/*.css', to: 'assets/sweetalert/css/[name][ext]' },
{ from: './node_modules/sweetalert2/dist/*.js', to: 'assets/sweetalert/js/[name][ext]' },
{ from: './node_modules/popper.js/dist/*.js', to: 'assets/js/[name][ext]' },
{ from: './node_modules/datatables/media/css/*.css', to: 'assets/jquery/css/[name][ext]' },
{ from: './node_modules/datatables/media/js/*.js', to: 'assets/jquery/js/[name][ext]' },
{ from: './node_modules/jquery/dist/*.js', to: 'assets/jquery/js/[name][ext]' },
{ from: './node_modules/swagger-ui-dist/*.css', to: 'assets/swagger/css/[name][ext]' },
{ from: './node_modules/swagger-ui-dist/*.js', to: 'assets/swagger/js/[name][ext]' },
{ from: './node_modules/datatables/media/images', to: 'assets/jquery/images' },
]
})
],
resolve: {
extensions: ['.js', 'css']
},
devtool: 'source-map' // Optional, for easier debugging
};
};