-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.cjs
95 lines (93 loc) · 2.63 KB
/
webpack.config.cjs
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
const path = require('path');
const webpack = require('webpack');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
mode: "development",
entry: {
core: {
import: "./core/core.js"
},
datastore: {
import: './datastore/datastore.js'
},
desktop: {
import: './desktop/desktop.js'
},
event: {
import: './event/event.js'
},
responder: {
import: './responder/responder.js'
},
statechart: {
import: './statechart/statechart.js',
},
view: {
import: './view/view.js'
},
testing: {
import: './testing/testing.js'
},
sproutcore_global: {
import: "./sproutcore.js",
},
sproutcore_css: {
import: './sproutcore_css.js'
},
aki_theme: {
import: './themes/aki/theme.js'
}
},
plugins: [
new webpack.ProvidePlugin({
// $: path.resolve(__dirname, 'node_modules/jquery/dist/jquery.slim.js'),
// jQuery: path.resolve(__dirname, 'node_modules/jquery/dist/jquery.slim.js'),
}),
new MiniCssExtractPlugin({
filename: '[name].css',
}),
],
output: {
assetModuleFilename: `assets/[name].[hash][ext][query]`,
},
module: {
rules: [
{
test: /\.(png|jpg|gif|svg|xls)$/,
type: 'asset/resource',
},
{
test: /\.s?css$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
},
'css-loader',
{
loader: 'sass-loader',
options: {
// additionalData: (content: string): string => {
// // replace $theme. by #{$theme}.
// // Sadly this doesn't work, because if files are @imported which by themselves also use unwrapped $theme, it still causes an error.
// // as the import still uses the unwrapped $theme...
// // the only way seems to be to hack the sass-loader to do the replace for us... _not_ nice, and it seems to be much easier
// // to simply replace it by hand...
// //
// const regexp = /\$theme\./gi;
// const newContent = content.replace(regexp, '#{$theme}.');
// return `@import "./apps/carta/resources/_theme.scss"; \n ${newContent}`;
// },
sassOptions: {
includePaths: [
path.resolve(
'./node_modules/compass-mixins-fixed/lib'
),
],
},
},
},
],
},
]
}
}