test(es/modules): Add tests for jsc.paths (#5876)

**Description:**

Those issues were wrong.

**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/4890
 - Closes https://github.com/swc-project/swc/issues/5214
This commit is contained in:
Donny/강동윤 2022-09-15 22:17:48 +09:00 committed by GitHub
parent dd2a7c1cd1
commit 0d492bfce1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 107 additions and 0 deletions

View File

@ -0,0 +1,24 @@
{
"jsc": {
"paths": {
"~/*": [
"./src/*"
]
},
"baseUrl": "./",
"parser": {
"syntax": "typescript",
"tsx": true,
"decorators": true,
"dynamicImport": true
},
"transform": {
"react": {
"runtime": "automatic"
}
}
},
"module": {
"type": "es6"
}
}

View File

@ -0,0 +1,4 @@
import styles from '~/MyModule.scss'
console.log(styles)

View File

@ -0,0 +1,3 @@
div{
color: red;
}

View File

@ -0,0 +1,2 @@
import styles from "./src/MyModule.scss";
console.log(styles);

View File

@ -0,0 +1,24 @@
{
"jsc": {
"paths": {
"~/*": [
"./src/*"
]
},
"baseUrl": "./",
"parser": {
"syntax": "typescript",
"tsx": true,
"decorators": true,
"dynamicImport": true
},
"transform": {
"react": {
"runtime": "automatic"
}
}
},
"module": {
"type": "es6"
}
}

View File

@ -0,0 +1,4 @@
import styles from '~/foo.bar.baz'
console.log(styles)

View File

@ -0,0 +1,4 @@
import styles from '~/foo.bar.baz.js'
console.log(styles)

View File

@ -0,0 +1 @@
console.log('exists')

View File

@ -0,0 +1,2 @@
import styles from "./src/foo.bar.baz";
console.log(styles);

View File

@ -0,0 +1,2 @@
import styles from "./src/foo.bar.baz.js";
console.log(styles);

View File

@ -0,0 +1 @@
console.log("exists");

View File

@ -0,0 +1,24 @@
{
"jsc": {
"paths": {
"~/*": [
"./src/*"
]
},
"baseUrl": "./",
"parser": {
"syntax": "typescript",
"tsx": true,
"decorators": true,
"dynamicImport": true
},
"transform": {
"react": {
"runtime": "automatic"
}
}
},
"module": {
"type": "es6"
}
}

View File

@ -0,0 +1,4 @@
import styles from '~/foo.bar.baz'
console.log(styles)

View File

@ -0,0 +1,4 @@
import styles from '~/foo.bar.baz.js'
console.log(styles)

View File

@ -0,0 +1,2 @@
import styles from "./src/foo.bar.baz";
console.log(styles);

View File

@ -0,0 +1,2 @@
import styles from "./src/foo.bar.baz.js";
console.log(styles);