-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathrspack.config.js
More file actions
68 lines (66 loc) · 1.54 KB
/
rspack.config.js
File metadata and controls
68 lines (66 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
const { rspack } = require('@rspack/core');
const { VueLoaderPlugin } = require('vue-loader');
const path = require('path');
const toPosixPath = (filepath) => (path.sep === '/' ? filepath : filepath.replace(/\\/g, '/'));
/** @type {import('@rspack/cli').Configuration} */
const config = {
context: __dirname,
entry: {
main: './src/main.ts',
},
devServer: {
historyApiFallback: true,
},
output: {
// ensure the source map is correct for .vue files
devtoolModuleFilenameTemplate: (info) => toPosixPath(info.absoluteResourcePath),
},
devtool: process.env.NODE_ENV === 'development' ? 'cheap-module-source-map' : false,
plugins: [
new VueLoaderPlugin(),
new rspack.HtmlRspackPlugin({
template: './index.html',
}),
],
resolve: {
extensions: ['.vue', '.ts', '...'],
},
module: {
rules: [
{
test: /\.vue$/,
use: 'vue-loader',
},
{
test: /\.ts$/,
loader: 'builtin:swc-loader',
options: {
jsc: {
parser: {
syntax: 'typescript',
},
},
},
type: 'javascript/auto',
},
{
test: /\.less$/,
use: ['vue-style-loader', 'css-loader', 'less-loader'],
type: 'javascript/auto',
},
{
test: /\.css$/,
use: ['vue-style-loader', 'css-loader'],
type: 'javascript/auto',
},
{
test: /\.svg$/,
type: 'asset/resource',
},
],
},
experiments: {
css: false,
},
};
module.exports = config;