mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-04 22:56:20 +08:00
refactor(nx/client): use composable webpack config
This commit is contained in:
parent
ae85ec6ca6
commit
528704ef71
@ -1,80 +1,83 @@
|
|||||||
|
|
||||||
const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin');
|
const { composePlugins, withNx, withWeb } = require('@nx/webpack');
|
||||||
const { join } = require('path');
|
const { join } = require('path');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = composePlugins(
|
||||||
output: {
|
withNx({
|
||||||
path: join(__dirname, 'dist'),
|
tsConfig: join(__dirname, './tsconfig.app.json'),
|
||||||
},
|
compiler: "tsc",
|
||||||
devServer: {
|
main: join(__dirname, "./src/index.ts"),
|
||||||
port: 4200,
|
additionalEntryPoints: [
|
||||||
client: {
|
{
|
||||||
overlay: {
|
entryName: "desktop",
|
||||||
errors: true,
|
entryPath: join(__dirname, "./src/desktop.ts")
|
||||||
warnings: false,
|
|
||||||
runtimeErrors: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new NxAppWebpackPlugin({
|
|
||||||
tsConfig: './tsconfig.app.json',
|
|
||||||
compiler: 'swc',
|
|
||||||
main: "./src/index.ts",
|
|
||||||
additionalEntryPoints: [
|
|
||||||
{
|
|
||||||
entryName: "desktop",
|
|
||||||
entryPath: "./src/desktop.ts"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
entryName: "mobile",
|
|
||||||
entryPath: "./src/mobile.ts"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
entryName: "login",
|
|
||||||
entryPath: "./src/login.ts"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
entryName: "setup",
|
|
||||||
entryPath: "./src/setup.ts"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
entryName: "share",
|
|
||||||
entryPath: "./src/share.ts"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
// TriliumNextTODO: integrate set_password into setup entry point/view
|
|
||||||
entryName: "set_password",
|
|
||||||
entryPath: "./src/set_password.ts"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
externalDependencies: [
|
|
||||||
"electron"
|
|
||||||
],
|
|
||||||
baseHref: '/',
|
|
||||||
assets: [
|
|
||||||
"./src/assets",
|
|
||||||
"./src/stylesheets",
|
|
||||||
"./src/libraries",
|
|
||||||
"./src/fonts",
|
|
||||||
"./src/translations"
|
|
||||||
],
|
|
||||||
styles: [],
|
|
||||||
stylePreprocessorOptions: {
|
|
||||||
sassOptions: {
|
|
||||||
quietDeps: true
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
outputHashing: false,
|
{
|
||||||
optimization: process.env['NODE_ENV'] === 'production',
|
entryName: "mobile",
|
||||||
})
|
entryPath: join(__dirname, "./src/mobile.ts")
|
||||||
],
|
},
|
||||||
resolve: {
|
{
|
||||||
fallback: {
|
entryName: "login",
|
||||||
path: false,
|
entryPath: join(__dirname, "./src/login.ts")
|
||||||
fs: false,
|
},
|
||||||
util: false
|
{
|
||||||
}
|
entryName: "setup",
|
||||||
}
|
entryPath: join(__dirname, "./src/setup.ts")
|
||||||
};
|
},
|
||||||
|
{
|
||||||
|
entryName: "share",
|
||||||
|
entryPath: join(__dirname, "./src/share.ts")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// TriliumNextTODO: integrate set_password into setup entry point/view
|
||||||
|
entryName: "set_password",
|
||||||
|
entryPath: join(__dirname, "./src/set_password.ts")
|
||||||
|
}
|
||||||
|
],
|
||||||
|
externalDependencies: [
|
||||||
|
"electron"
|
||||||
|
],
|
||||||
|
baseHref: '/',
|
||||||
|
assets: [
|
||||||
|
join(__dirname, "./src/assets"),
|
||||||
|
join(__dirname, "./src/stylesheets"),
|
||||||
|
join(__dirname, "./src/libraries"),
|
||||||
|
join(__dirname, "./src/fonts"),
|
||||||
|
join(__dirname, "./src/translations")
|
||||||
|
],
|
||||||
|
outputHashing: false,
|
||||||
|
optimization: process.env['NODE_ENV'] === 'production'
|
||||||
|
}),
|
||||||
|
withWeb({
|
||||||
|
styles: [],
|
||||||
|
stylePreprocessorOptions: {
|
||||||
|
sassOptions: {
|
||||||
|
quietDeps: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
(config) => {
|
||||||
|
config.output = {
|
||||||
|
path: join(__dirname, 'dist')
|
||||||
|
};
|
||||||
|
|
||||||
|
config.devServer = {
|
||||||
|
port: 4200,
|
||||||
|
client: {
|
||||||
|
overlay: {
|
||||||
|
errors: true,
|
||||||
|
warnings: false,
|
||||||
|
runtimeErrors: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
config.resolve.fallback = {
|
||||||
|
path: false,
|
||||||
|
fs: false,
|
||||||
|
util: false
|
||||||
|
};
|
||||||
|
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
);
|
Loading…
x
Reference in New Issue
Block a user