-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Niilo Keinänen
committed
Aug 5, 2024
1 parent
5099660
commit a517f3c
Showing
4 changed files
with
89 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,70 @@ | ||
const HtmlWebpackPlugin = require("html-webpack-plugin"); | ||
const { CleanWebpackPlugin } = require("clean-webpack-plugin"); | ||
const CopyWebpackPlugin = require("copy-webpack-plugin"); | ||
const path = require("path"); | ||
const webpack = require('webpack'); | ||
const HtmlWebpackPlugin = require('html-webpack-plugin') | ||
const { CleanWebpackPlugin } = require('clean-webpack-plugin') | ||
const CopyWebpackPlugin = require('copy-webpack-plugin') | ||
const path = require('path') | ||
const webpack = require('webpack') | ||
|
||
const targetFolderName = "dist"; | ||
const outputPath = path.resolve(__dirname, targetFolderName); | ||
const packageJSON = require("./package.json"); | ||
const targetFolderName = 'dist' | ||
const outputPath = path.resolve(__dirname, targetFolderName) | ||
const packageJSON = require('./package.json') | ||
|
||
module.exports = { | ||
mode: "development", | ||
entry: { | ||
app: packageJSON.main, | ||
}, | ||
devServer: { | ||
static: outputPath, | ||
compress: true, | ||
}, | ||
resolve: { | ||
modules: [path.resolve("./src"), path.resolve("./node_modules")], | ||
extensions: [".js"], | ||
}, | ||
output: { | ||
filename: "js/[name].[contenthash].bundle.js", | ||
chunkFilename: "js/[name].[contenthash].bundle.js", | ||
path: outputPath, | ||
}, | ||
optimization: { | ||
splitChunks: { | ||
chunks: "all", | ||
cacheGroups: { | ||
// make separate 'vendor' chunk that contains any dependencies | ||
// allows for smaller file sizes and faster builds | ||
vendor: { | ||
test: /[\\/]node_modules[\\/]/, | ||
chunks: "initial", | ||
name: "vendor", | ||
priority: -10, | ||
reuseExistingChunk: true, | ||
}, | ||
}, | ||
mode: 'development', | ||
entry: { | ||
app: packageJSON.main, | ||
}, | ||
runtimeChunk: "single", | ||
}, | ||
plugins: [ | ||
new CleanWebpackPlugin(), | ||
new HtmlWebpackPlugin({ | ||
title: "app", | ||
filename: path.resolve(__dirname, "dist", "index.html"), | ||
}), | ||
new CopyWebpackPlugin({ | ||
patterns: [ | ||
{ | ||
from: "./assets/**/*", | ||
to: `./examples/assets/${packageJSON.lightningChart.eID}/[name][ext]`, | ||
noErrorOnMissing: true, | ||
}, | ||
{ | ||
from: "./node_modules/@arction/lcjs/dist/resources", | ||
to: "resources", | ||
noErrorOnMissing: true, | ||
devServer: { | ||
static: outputPath, | ||
compress: true, | ||
}, | ||
resolve: { | ||
modules: [path.resolve('./src'), path.resolve('./node_modules')], | ||
extensions: ['.js'], | ||
}, | ||
output: { | ||
filename: 'js/[name].[contenthash].bundle.js', | ||
chunkFilename: 'js/[name].[contenthash].bundle.js', | ||
path: outputPath, | ||
}, | ||
optimization: { | ||
splitChunks: { | ||
chunks: 'all', | ||
cacheGroups: { | ||
// make separate 'vendor' chunk that contains any dependencies | ||
// allows for smaller file sizes and faster builds | ||
vendor: { | ||
test: /[\\/]node_modules[\\/]/, | ||
chunks: 'initial', | ||
name: 'vendor', | ||
priority: -10, | ||
reuseExistingChunk: true, | ||
}, | ||
}, | ||
}, | ||
], | ||
}), | ||
new webpack.DefinePlugin({ | ||
LCJS_LICENSE: "'" + process.env.LCJS_LICENSE + "'", | ||
}), | ||
], | ||
}; | ||
runtimeChunk: 'single', | ||
}, | ||
plugins: [ | ||
new CleanWebpackPlugin(), | ||
new HtmlWebpackPlugin({ | ||
title: 'app', | ||
filename: path.resolve(__dirname, 'dist', 'index.html'), | ||
}), | ||
new CopyWebpackPlugin({ | ||
patterns: [ | ||
{ | ||
from: './assets/**/*', | ||
to: `./examples/assets/${packageJSON.lightningChart.eID}/[name][ext]`, | ||
noErrorOnMissing: true, | ||
}, | ||
{ | ||
from: './node_modules/@lightningchart/lcjs/dist/resources', | ||
to: 'resources', | ||
noErrorOnMissing: true, | ||
}, | ||
], | ||
}), | ||
new webpack.DefinePlugin({ | ||
LCJS_LICENSE: "'" + process.env.LCJS_LICENSE + "'", | ||
}), | ||
], | ||
} |