const path = require('path');
/** @type {import('@rspack/cli').Configuration} */
const config = {
context: __dirname,
entry: {
main: './src/main.ts',
},
resolve: {
alias: {
svelte: path.dirname(require.resolve('svelte/package.json')),
},
extensions: ['.mjs', '.js', '.ts', '.svelte'],
mainFields: ['svelte', 'browser', 'module', 'main'],
},
module: {
rules: [
{
test: /\.svelte$/,
use: [
{
loader: 'svelte-loader',
options: {
compilerOptions: {
dev: !prod,
},
emitCss: prod,
hotReload: !prod,
preprocess: sveltePreprocess({ sourceMap: !prod, postcss: true }),
},
},
],
},
],
},
};
module.exports = config;