build / build (push) Successful in 3m10s
Upstream Pinafore hardcodes root-absolute internal links, so the app only works served at /. BASEPATH is injected at build time (DefinePlugin, set by build-nc); bp() prefixes at the DOM/navigation boundary only — route strings in state and comparisons stay unprefixed. With --basepath alone, Sapper moved assets and the router but every link click escaped the SPA (observed live: nav links landing on the wrapping Nextcloud origin). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
import { LOCALE } from '../src/routes/_static/intl'
|
|
import path from 'path'
|
|
|
|
import config from 'sapper/config/webpack.js'
|
|
import terser from './terser.config'
|
|
import webpack from 'webpack'
|
|
import { mode, dev, resolve } from './shared.config'
|
|
|
|
export default {
|
|
entry: config.serviceworker.entry(),
|
|
output: config.serviceworker.output(),
|
|
resolve,
|
|
mode,
|
|
devtool: dev ? 'inline-source-map' : 'source-map',
|
|
optimization: dev
|
|
? {}
|
|
: {
|
|
minimize: !process.env.DEBUG,
|
|
minimizer: [
|
|
terser()
|
|
]
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.js$/,
|
|
exclude: /node_modules/,
|
|
use: {
|
|
loader: path.join(__dirname, './svelte-intl-loader.cjs')
|
|
}
|
|
}
|
|
]
|
|
},
|
|
plugins: [
|
|
new webpack.DefinePlugin({
|
|
'process.browser': true,
|
|
'process.env.NODE_ENV': JSON.stringify(mode),
|
|
'process.env.SAPPER_TIMESTAMP': process.env.SAPPER_TIMESTAMP || Date.now(),
|
|
'process.env.LOCALE': JSON.stringify(LOCALE),
|
|
'process.env.IS_SERVICE_WORKER': 'true',
|
|
'process.env.BASEPATH': JSON.stringify(process.env.BASEPATH || ''),
|
|
'process.env.IS_CLOUDFLARE': JSON.stringify(!!process.env.IS_CLOUDFLARE),
|
|
})
|
|
].filter(Boolean)
|
|
}
|