@s-ui/bundler 9.39.0-typescript.6 → 9.39.0-typescript.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/shared/module-rules-babel.js +22 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@s-ui/bundler",
|
|
3
|
-
"version": "9.39.0-typescript.
|
|
3
|
+
"version": "9.39.0-typescript.7",
|
|
4
4
|
"description": "Config-free bundler for ES6 React apps.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"sui-bundler": "./bin/sui-bundler.js"
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"stream-http": "3.2.0",
|
|
49
49
|
"strip-ansi": "6.0.1",
|
|
50
50
|
"style-loader": "3.3.1",
|
|
51
|
-
"swc-loader": "
|
|
51
|
+
"swc-loader": "0.2.1",
|
|
52
52
|
"url": "0.11.0",
|
|
53
53
|
"webpack": "5.82.1",
|
|
54
54
|
"webpack-dev-server": "4.10.0",
|
|
@@ -3,23 +3,32 @@ const fs = require('fs-extra')
|
|
|
3
3
|
const path = require('path')
|
|
4
4
|
const {config} = require('./index.js')
|
|
5
5
|
|
|
6
|
-
const
|
|
7
|
-
|
|
6
|
+
const EXCLUDED_FOLDERS_REGEXP = new RegExp(
|
|
7
|
+
`node_modules(?!${path.sep}@s-ui(${path.sep}studio)(${path.sep}workbench)?${path.sep}src)`
|
|
8
|
+
)
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const getTSConfig = () => {
|
|
11
|
+
// Get TS config from the package dir.
|
|
12
|
+
const tsConfigPath = path.join(process.cwd(), 'tsconfig.json')
|
|
13
|
+
let tsConfig
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
if (fs.existsSync(tsConfigPath)) {
|
|
17
|
+
tsConfig = JSON.parse(fs.readFileSync(tsConfigPath, {encoding: 'utf8'}))
|
|
18
|
+
}
|
|
19
|
+
} catch (err) {
|
|
20
|
+
console.error(err)
|
|
12
21
|
}
|
|
13
|
-
|
|
14
|
-
|
|
22
|
+
|
|
23
|
+
return tsConfig
|
|
15
24
|
}
|
|
16
25
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
26
|
+
module.exports = ({isServer = false, supportLegacyBrowsers = true} = {}) => {
|
|
27
|
+
const tsConfig = getTSConfig()
|
|
28
|
+
// If TS config exists in root dir, set TypeScript as enabled.
|
|
29
|
+
const isTypeScriptEnabled = Boolean(tsConfig)
|
|
20
30
|
|
|
21
|
-
|
|
22
|
-
isTypeScriptEnabled
|
|
31
|
+
return isTypeScriptEnabled
|
|
23
32
|
? {
|
|
24
33
|
test: /\.(js|ts)x?$/,
|
|
25
34
|
exclude: EXCLUDED_FOLDERS_REGEXP,
|
|
@@ -91,3 +100,4 @@ module.exports = ({isServer = false, supportLegacyBrowsers = true} = {}) =>
|
|
|
91
100
|
}
|
|
92
101
|
]
|
|
93
102
|
}
|
|
103
|
+
}
|