forked from jjeff/jjeff-electron-quickstart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.renderer.config.ts
56 lines (54 loc) · 1.19 KB
/
webpack.renderer.config.ts
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
import type { Configuration, ModuleOptions } from 'webpack'
import { plugins } from './webpack.plugins'
import { rules } from './webpack.rules'
const rendererRules: ModuleOptions['rules'] = [
...rules,
{
test: /\.css$/,
use: [{ loader: 'style-loader' }, { loader: 'css-loader' }],
},
{
test: /\.less$/i,
use: [
// compiles Less to CSS
{ loader: 'style-loader' },
{ loader: 'css-loader' },
{ loader: 'less-loader' },
],
},
{
// scss support
test: /\.s[ac]ss$/i,
use: [
// Creates `style` nodes from JS strings
{ loader: 'style-loader' },
// Translates CSS into CommonJS
{ loader: 'css-loader' },
// Compiles Sass to CSS
{ loader: 'sass-loader' },
],
},
]
export const rendererConfig: Configuration = {
module: {
rules: rendererRules,
},
plugins,
resolve: {
extensions: [
'.js',
'.ts',
'.jsx',
'.tsx',
'.css',
'.less',
'.json',
'.svelte',
],
mainFields: ['svelte', 'browser', 'module', 'main'],
conditionNames: ['svelte', 'require', 'node'],
alias: {
// file to resolve the 'fs' module in the renderer process
},
},
}