|
1 | | -const HtmlWebpackPlugin = require("html-webpack-plugin"); |
2 | | -const { CleanWebpackPlugin } = require("clean-webpack-plugin"); |
3 | | -const CopyWebpackPlugin = require("copy-webpack-plugin"); |
4 | | -const path = require("path"); |
5 | | -const webpack = require('webpack'); |
| 1 | +const HtmlWebpackPlugin = require('html-webpack-plugin') |
| 2 | +const { CleanWebpackPlugin } = require('clean-webpack-plugin') |
| 3 | +const CopyWebpackPlugin = require('copy-webpack-plugin') |
| 4 | +const path = require('path') |
| 5 | +const webpack = require('webpack') |
6 | 6 |
|
7 | | -const targetFolderName = "dist"; |
8 | | -const outputPath = path.resolve(__dirname, targetFolderName); |
9 | | -const packageJSON = require("./package.json"); |
| 7 | +const targetFolderName = 'dist' |
| 8 | +const outputPath = path.resolve(__dirname, targetFolderName) |
| 9 | +const packageJSON = require('./package.json') |
10 | 10 |
|
11 | 11 | module.exports = { |
12 | | - mode: "development", |
13 | | - entry: { |
14 | | - app: packageJSON.main, |
15 | | - }, |
16 | | - devServer: { |
17 | | - static: outputPath, |
18 | | - compress: true, |
19 | | - }, |
20 | | - resolve: { |
21 | | - modules: [path.resolve("./src"), path.resolve("./node_modules")], |
22 | | - extensions: [".js"], |
23 | | - }, |
24 | | - output: { |
25 | | - filename: "js/[name].[contenthash].bundle.js", |
26 | | - chunkFilename: "js/[name].[contenthash].bundle.js", |
27 | | - path: outputPath, |
28 | | - }, |
29 | | - optimization: { |
30 | | - splitChunks: { |
31 | | - chunks: "all", |
32 | | - cacheGroups: { |
33 | | - // make separate 'vendor' chunk that contains any dependencies |
34 | | - // allows for smaller file sizes and faster builds |
35 | | - vendor: { |
36 | | - test: /[\\/]node_modules[\\/]/, |
37 | | - chunks: "initial", |
38 | | - name: "vendor", |
39 | | - priority: -10, |
40 | | - reuseExistingChunk: true, |
41 | | - }, |
42 | | - }, |
| 12 | + mode: 'development', |
| 13 | + entry: { |
| 14 | + app: packageJSON.main, |
43 | 15 | }, |
44 | | - runtimeChunk: "single", |
45 | | - }, |
46 | | - plugins: [ |
47 | | - new CleanWebpackPlugin(), |
48 | | - new HtmlWebpackPlugin({ |
49 | | - title: "app", |
50 | | - filename: path.resolve(__dirname, "dist", "index.html"), |
51 | | - }), |
52 | | - new CopyWebpackPlugin({ |
53 | | - patterns: [ |
54 | | - { |
55 | | - from: "./assets/**/*", |
56 | | - to: `./examples/assets/${packageJSON.lightningChart.eID}/[name][ext]`, |
57 | | - noErrorOnMissing: true, |
58 | | - }, |
59 | | - { |
60 | | - from: "./node_modules/@arction/lcjs/dist/resources", |
61 | | - to: "resources", |
62 | | - noErrorOnMissing: true, |
| 16 | + devServer: { |
| 17 | + static: outputPath, |
| 18 | + compress: true, |
| 19 | + }, |
| 20 | + resolve: { |
| 21 | + modules: [path.resolve('./src'), path.resolve('./node_modules')], |
| 22 | + extensions: ['.js'], |
| 23 | + }, |
| 24 | + output: { |
| 25 | + filename: 'js/[name].[contenthash].bundle.js', |
| 26 | + chunkFilename: 'js/[name].[contenthash].bundle.js', |
| 27 | + path: outputPath, |
| 28 | + }, |
| 29 | + optimization: { |
| 30 | + splitChunks: { |
| 31 | + chunks: 'all', |
| 32 | + cacheGroups: { |
| 33 | + // make separate 'vendor' chunk that contains any dependencies |
| 34 | + // allows for smaller file sizes and faster builds |
| 35 | + vendor: { |
| 36 | + test: /[\\/]node_modules[\\/]/, |
| 37 | + chunks: 'initial', |
| 38 | + name: 'vendor', |
| 39 | + priority: -10, |
| 40 | + reuseExistingChunk: true, |
| 41 | + }, |
| 42 | + }, |
63 | 43 | }, |
64 | | - ], |
65 | | - }), |
66 | | - new webpack.DefinePlugin({ |
67 | | - LCJS_LICENSE: "'" + process.env.LCJS_LICENSE + "'", |
68 | | - }), |
69 | | - ], |
70 | | -}; |
| 44 | + runtimeChunk: 'single', |
| 45 | + }, |
| 46 | + plugins: [ |
| 47 | + new CleanWebpackPlugin(), |
| 48 | + new HtmlWebpackPlugin({ |
| 49 | + title: 'app', |
| 50 | + filename: path.resolve(__dirname, 'dist', 'index.html'), |
| 51 | + }), |
| 52 | + new CopyWebpackPlugin({ |
| 53 | + patterns: [ |
| 54 | + { |
| 55 | + from: './assets/**/*', |
| 56 | + to: `./examples/assets/${packageJSON.lightningChart.eID}/[name][ext]`, |
| 57 | + noErrorOnMissing: true, |
| 58 | + }, |
| 59 | + { |
| 60 | + from: './node_modules/@lightningchart/lcjs/dist/resources', |
| 61 | + to: 'resources', |
| 62 | + noErrorOnMissing: true, |
| 63 | + }, |
| 64 | + ], |
| 65 | + }), |
| 66 | + new webpack.DefinePlugin({ |
| 67 | + LCJS_LICENSE: "'" + process.env.LCJS_LICENSE + "'", |
| 68 | + }), |
| 69 | + ], |
| 70 | +} |
0 commit comments