1 | const path = require('path');
|
2 | const CopyPlugin = require('copy-webpack-plugin');
|
3 | const WriteFilePlugin = require('write-file-webpack-plugin');
|
4 | const CleanWebpackPlugin = require('clean-webpack-plugin');
|
5 |
|
6 | module.exports = env => {
|
7 |
|
8 | return {
|
9 | context: __dirname,
|
10 | entry: {
|
11 | simulator: __dirname + "/src/display-app/index.tsx",
|
12 | "widget-host": __dirname + "/src/widget-host/index.tsx",
|
13 | },
|
14 | output: {
|
15 | path: path.resolve(__dirname, "build"),
|
16 | filename: "[name].app.js"
|
17 | },
|
18 | devServer: {
|
19 | contentBase: path.resolve(__dirname, "build"),
|
20 | port: 5555
|
21 | },
|
22 | plugins: [
|
23 | new CopyPlugin([
|
24 | {from: __dirname + '/pages/*.html', to: __dirname + '/build/[name].[ext]'},
|
25 | {from: env.bundleFile, to: __dirname + '/build/test-widget.bundle.js'},
|
26 | {from: env.mockFile, to: __dirname + '/build/host-mock.bundle.js'},
|
27 | {
|
28 | from: require.resolve('@talentsoft-opensource/integration-dll/dist/integration.dll.js'),
|
29 | to: __dirname + '/build/integration.dll.js'
|
30 | },
|
31 | {
|
32 | from: require.resolve('@talentsoft-opensource/display-tool-widget-mock/dist/main.bundle.js'),
|
33 | to: __dirname + '/build/mock-widget.bundle.js'
|
34 | }
|
35 | ]),
|
36 | new WriteFilePlugin(),
|
37 | new CleanWebpackPlugin(),
|
38 | ],
|
39 | resolve: {
|
40 | extensions: ['.ts', '.js', '.tsx']
|
41 | },
|
42 | module: {
|
43 | rules: [
|
44 | {
|
45 | test: /\.less$/,
|
46 | use: [{
|
47 | loader: 'style-loader'
|
48 | }, {
|
49 | loader: 'css-loader'
|
50 | }, {
|
51 | loader: 'less-loader',
|
52 | options: {
|
53 | importLoaders: 1,
|
54 | paths: [path.resolve(__dirname + '../../../', 'node_modules')],
|
55 |
|
56 | }
|
57 | }]
|
58 | },
|
59 | {
|
60 | test: /\.tsx?$/,
|
61 | use: 'ts-loader',
|
62 | },
|
63 | {
|
64 | test: /\.(woff|woff2|eot|ttf|svg)$/,
|
65 | include: /node_modules/,
|
66 | loader: "file-loader",
|
67 | options: {
|
68 | name: "dist/assets/fonts/[name].[ext]",
|
69 | publicPath: ""
|
70 | }
|
71 | },
|
72 | {
|
73 | test: /\.(svg|png|jpg|gif)$/,
|
74 | loader: "file-loader",
|
75 | options: {
|
76 | name: "assets/images/[name].[ext]",
|
77 | publicPath: ""
|
78 | }
|
79 | },
|
80 | ]
|
81 | }
|
82 | }
|
83 | }; |
\ | No newline at end of file |