lx-music-desktop/build-config/main/webpack.config.base.js

48 lines
1.2 KiB
JavaScript
Raw Normal View History

2019-08-16 09:27:23 +00:00
const path = require('path')
2021-10-15 11:54:48 +00:00
const ESLintPlugin = require('eslint-webpack-plugin')
2019-08-16 09:27:23 +00:00
2023-02-04 10:38:06 +00:00
const isDev = process.env.NODE_ENV === 'development'
2019-08-16 09:27:23 +00:00
module.exports = {
target: 'electron-main',
output: {
filename: '[name].js',
2022-10-29 03:36:35 +00:00
library: {
type: 'commonjs2',
},
2022-05-11 07:37:06 +00:00
path: path.join(__dirname, '../../dist'),
2019-08-16 09:27:23 +00:00
},
2023-02-04 10:38:06 +00:00
externals: {
'font-list': 'font-list',
'better-sqlite3': 'better-sqlite3',
bufferutil: 'bufferutil',
'utf-8-validate': 'utf-8-validate',
'qrc_decode.node': isDev ? path.join(__dirname, '../../build/Release/qrc_decode.node') : path.join('../build/Release/qrc_decode.node'),
},
2019-08-16 09:27:23 +00:00
resolve: {
alias: {
2020-11-28 12:23:17 +00:00
'@main': path.join(__dirname, '../../src/main'),
'@renderer': path.join(__dirname, '../../src/renderer'),
'@lyric': path.join(__dirname, '../../src/renderer-lyric'),
'@common': path.join(__dirname, '../../src/common'),
2019-08-16 09:27:23 +00:00
},
2022-10-29 03:36:35 +00:00
extensions: ['.tsx', '.ts', '.js', '.mjs', '.json', '.node'],
2019-08-16 09:27:23 +00:00
},
module: {
rules: [
2021-08-29 10:27:01 +00:00
{
test: /\.node$/,
use: 'node-loader',
},
2022-10-29 03:36:35 +00:00
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
2019-08-16 09:27:23 +00:00
],
},
2021-10-15 11:54:48 +00:00
plugins: [
new ESLintPlugin(),
],
2019-08-16 09:27:23 +00:00
}