-
Notifications
You must be signed in to change notification settings - Fork 65
Expand file tree
/
Copy pathrspack.config.js
More file actions
64 lines (63 loc) · 1.84 KB
/
rspack.config.js
File metadata and controls
64 lines (63 loc) · 1.84 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
const { defineConfig } = require('@meteorjs/rspack')
const path = require('path')
/**
* Rspack configuration for Meteor projects.
*/
module.exports = defineConfig((Meteor) => ({
module: {
rules: [
// ignore TypeScript declaration files (but only outside of node_modules we want to check)
{
test: /\.d\.ts$/,
exclude: /node_modules/,
loader: 'ignore-loader',
},
// ignore TypeScript definition files in dayjs entirely
{
test: /dayjs.*\.d\.ts$/,
type: 'asset/source',
},
// Handle SCSS files: Compile with sass-loader, then let Rspack handle the CSS
{
test: /\.s[ac]ss$/i,
type: 'css/auto', // 'css/auto' allows Rspack to also handle CSS modules if you ever need them
use: [
{
loader: 'sass-loader',
options: {
sassOptions: {
// This helps sass-loader easily resolve bare imports like 'bootstrap/...'
includePaths: [path.resolve(__dirname, 'node_modules')],
},
},
},
],
},
{
test: /\.m?js$/,
resolve: {
fullySpecified: false,
},
},
],
},
resolve: {
// make sure webpack resolves the extensions we use and skip .d.ts
// Added .scss and .sass here just to be safe
extensions: ['.js', '.jsx', '.mjs', '.ts', '.tsx', '.json', '.scss', '.sass'],
extensionAlias: {
'.js': ['.ts', '.js'],
},
// allow imports without full specifier so that packages with ESM can work
fullySpecified: false,
},
stats: {
warningsFilter: [
/Critical dependency: the request of a dependency is an expression/,
/export.*was not found/,
/Unable to resolve loader/,
/Module not found/,
/TypeError.*Cannot read properties/,
],
},
}))