forked from SolidOS/solid-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
88 lines (75 loc) · 1.93 KB
/
main.js
File metadata and controls
88 lines (75 loc) · 1.93 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import Icons from 'unplugin-icons/webpack'
import iconsConfig from '../config/icons'
import postCSSConfig from '../config/postcss'
export default {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
swc: (config) => ({
...config,
jsc: {
...config.jsc,
parser: {
...config.jsc?.parser,
decorators: true,
},
transform: {
...config.jsc?.transform,
legacyDecorator: true,
useDefineForClassFields: false,
},
},
}),
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-mdx-gfm',
'@storybook/addon-webpack5-compiler-swc'
],
framework: {
name: '@storybook/html-webpack5',
options: {}
},
docs: {
autodocs: true
},
webpackFinal: async (config) => {
// For Storybook, we DON'T externalize rdflib and solid-logic
// Instead, we let webpack bundle them from node_modules
// Handle Node.js modules for browser
config.resolve.fallback = {
...config.resolve.fallback,
path: false,
fs: false,
crypto: false,
stream: false,
util: false,
buffer: false
}
// Alias $rdf to rdflib for solid-logic compatibility
config.resolve.alias = {
...config.resolve.alias,
$rdf: 'rdflib'
}
// Configure icons
config.plugins.push(Icons(iconsConfig))
// Configure component styles
const litCssPattern = /\.styles\.css$/
config.module.rules = config.module.rules.map(rule => {
if (rule?.test?.test?.('component.css')) {
return {
...rule,
exclude: [
...(Array.isArray(rule.exclude) ? rule.exclude : rule.exclude ? [rule.exclude] : []),
litCssPattern
]
}
}
return rule
})
config.module.rules.push({
test: litCssPattern,
loader: 'lit-css-loader',
options: postCSSConfig
})
return config
}
}