-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from rspack-contrib/ts-config
chore: add ts config example
- Loading branch information
Showing
12 changed files
with
129 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Document</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "example-basic-tsconfig", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"private": true, | ||
"scripts": { | ||
"dev": "NODE_OPTIONS=\"--loader ts-node/esm\" rspack serve", | ||
"build": "NODE_OPTIONS=\"--loader ts-node/esm\" rspack build" | ||
}, | ||
"devDependencies": { | ||
"@rspack/cli": "latest", | ||
"@rspack/core": "latest", | ||
"ts-node": "10.9.2" | ||
}, | ||
"sideEffects": false, | ||
"keywords": [], | ||
"author": "", | ||
"license": "MIT" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import rspack from "@rspack/core"; | ||
import path from 'path'; | ||
import { fileURLToPath } from "url"; | ||
const __dirname = path.dirname(fileURLToPath(import.meta.url)); | ||
|
||
/** @type {import('@rspack/cli').Configuration} */ | ||
const config = { | ||
context: __dirname, | ||
entry: "./src/index.js", | ||
plugins: [ | ||
new rspack.HtmlRspackPlugin({ | ||
template: "./index.html" | ||
}) | ||
] | ||
}; | ||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const answer = 42; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { answer } from "./answer"; | ||
function render() { | ||
document.getElementById( | ||
"root" | ||
).innerHTML = `the answer to the universe is ${answer}`; | ||
} | ||
render(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"rootDir": ".", | ||
"target": "ESNext", | ||
"module": "NodeNext", | ||
"noEmit":true, | ||
"esModuleInterop": true, | ||
"resolveJsonModule":true, | ||
"moduleResolution": "nodenext", | ||
"allowImportingTsExtensions": true, | ||
"allowSyntheticDefaultImports": true, | ||
}, | ||
"include": ["**/*.ts", "**/*.js"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Document</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "example-basic-tsconfig", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"private": true, | ||
"scripts": { | ||
"dev": "rspack serve", | ||
"build": "rspack build" | ||
}, | ||
"devDependencies": { | ||
"@rspack/cli": "latest", | ||
"@rspack/core": "latest", | ||
"ts-node": "10.9.2" | ||
}, | ||
"sideEffects": false, | ||
"keywords": [], | ||
"author": "", | ||
"license": "MIT" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const rspack = require("@rspack/core"); | ||
/** @type {import('@rspack/cli').Configuration} */ | ||
const config = { | ||
entry: "./src/index.js", | ||
plugins: [ | ||
new rspack.HtmlRspackPlugin({ | ||
template: "./index.html" | ||
}) | ||
] | ||
}; | ||
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const answer = 42; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { answer } from "./answer"; | ||
function render() { | ||
document.getElementById( | ||
"root" | ||
).innerHTML = `the answer to the universe is ${answer}`; | ||
} | ||
render(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
const rspack = require("@rspack/core"); | ||
/** @type {import('@rspack/cli').Configuration} */ | ||
const config = { | ||
entry: "./src/index.js", | ||
plugins: [ | ||
new rspack.HtmlRspackPlugin({ | ||
template: "./index.html" | ||
}) | ||
] | ||
context: __dirname, | ||
entry: "./src/index.js", | ||
plugins: [ | ||
new rspack.HtmlRspackPlugin({ | ||
template: "./index.html", | ||
}), | ||
], | ||
}; | ||
module.exports = config; |