mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-05-17 18:21:57 +00:00
build config updated
This commit is contained in:
parent
55ab5fa607
commit
c28560754e
1 changed files with 36 additions and 17 deletions
|
|
@ -10,10 +10,14 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||||
const TerserPlugin = require('terser-webpack-plugin');
|
const TerserPlugin = require('terser-webpack-plugin');
|
||||||
const pachageJson = require('./package.json');
|
const pachageJson = require('./package.json');
|
||||||
|
|
||||||
|
const COMMIT_HASH = child_process.execSync('git rev-parse HEAD').toString().trim();
|
||||||
|
|
||||||
module.exports = (env, argv) => ({
|
module.exports = (env, argv) => ({
|
||||||
|
mode: argv.mode,
|
||||||
entry: './src/index.js',
|
entry: './src/index.js',
|
||||||
output: {
|
output: {
|
||||||
path: path.join(__dirname, 'build')
|
path: path.join(__dirname, 'build'),
|
||||||
|
filename: `${COMMIT_HASH}/scripts/[name].js`
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
|
|
@ -113,8 +117,10 @@ module.exports = (env, argv) => ({
|
||||||
exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
loader: 'file-loader',
|
loader: 'file-loader',
|
||||||
options: {
|
options: {
|
||||||
outputPath: 'fonts',
|
esModule: false,
|
||||||
publicPath: 'fonts',
|
name: '[name].[ext]',
|
||||||
|
outputPath: `${COMMIT_HASH}/fonts`,
|
||||||
|
publicPath: `/${COMMIT_HASH}/fonts`
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -123,8 +129,19 @@ module.exports = (env, argv) => ({
|
||||||
loader: 'file-loader',
|
loader: 'file-loader',
|
||||||
options: {
|
options: {
|
||||||
esModule: false,
|
esModule: false,
|
||||||
outputPath: 'images',
|
name: '[name].[ext]',
|
||||||
publicPath: 'images',
|
outputPath: `${COMMIT_HASH}/images`,
|
||||||
|
publicPath: `/${COMMIT_HASH}/images`
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.wasm$/,
|
||||||
|
loader: 'file-loader',
|
||||||
|
options: {
|
||||||
|
esModule: false,
|
||||||
|
name: '[name].[ext]',
|
||||||
|
outputPath: `${COMMIT_HASH}/binaries`,
|
||||||
|
publicPath: `/${COMMIT_HASH}/binaries`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
@ -132,12 +149,13 @@ module.exports = (env, argv) => ({
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['.js', '.json', '.less', '.wasm'],
|
extensions: ['.js', '.json', '.less', '.wasm'],
|
||||||
alias: {
|
alias: {
|
||||||
'stremio': path.resolve(__dirname, 'src'),
|
'stremio': path.join(__dirname, 'src'),
|
||||||
'stremio-router': path.resolve(__dirname, 'src/router')
|
'stremio-router': path.join(__dirname, 'src', 'router')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
devServer: {
|
devServer: {
|
||||||
host: '0.0.0.0',
|
host: '0.0.0.0',
|
||||||
|
contentBase: false,
|
||||||
hot: false,
|
hot: false,
|
||||||
inline: false,
|
inline: false,
|
||||||
https: true
|
https: true
|
||||||
|
|
@ -163,30 +181,31 @@ module.exports = (env, argv) => ({
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.EnvironmentPlugin({
|
new webpack.EnvironmentPlugin({
|
||||||
|
SENTRY_DSN: null,
|
||||||
|
...env,
|
||||||
DEBUG: argv.mode !== 'production',
|
DEBUG: argv.mode !== 'production',
|
||||||
VERSION: pachageJson.version,
|
VERSION: pachageJson.version,
|
||||||
COMMIT_HASH: child_process.execSync('git rev-parse HEAD').toString(),
|
COMMIT_HASH
|
||||||
SENTRY_DSN: null,
|
|
||||||
...env
|
|
||||||
}),
|
}),
|
||||||
new webpack.ProgressPlugin(),
|
new webpack.ProgressPlugin(),
|
||||||
new CopyWebpackPlugin({
|
new CopyWebpackPlugin({
|
||||||
patterns: [
|
patterns: [
|
||||||
{
|
{
|
||||||
from: 'node_modules/@stremio/stremio-core-web/stremio_core_web_bg.wasm',
|
from: 'favicons',
|
||||||
to: ''
|
to: `${COMMIT_HASH}/favicons`
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
new HtmlWebPackPlugin({
|
new HtmlWebPackPlugin({
|
||||||
template: './src/index.html',
|
template: './src/index.html',
|
||||||
inject: false
|
inject: false,
|
||||||
|
faviconsPath: `${COMMIT_HASH}/favicons`
|
||||||
|
}),
|
||||||
|
new MiniCssExtractPlugin({
|
||||||
|
filename: `${COMMIT_HASH}/styles/[name].css`
|
||||||
}),
|
}),
|
||||||
new MiniCssExtractPlugin(),
|
|
||||||
new CleanWebpackPlugin({
|
new CleanWebpackPlugin({
|
||||||
verbose: true,
|
cleanOnceBeforeBuildPatterns: ['*']
|
||||||
cleanOnceBeforeBuildPatterns: ['*'],
|
|
||||||
cleanAfterEveryBuildPatterns: ['./main.js', './main.css']
|
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue