generated from unplugin/unplugin-starter
-
Notifications
You must be signed in to change notification settings - Fork 3
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 #7 from Applelo/dev
Version 2.0.0
- Loading branch information
Showing
39 changed files
with
4,740 additions
and
956 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
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
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
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,8 @@ | ||
<html> | ||
<head> | ||
<!--__unplugin-inject-preload__--> | ||
</head> | ||
<body> | ||
<h1>Hello World</h1> | ||
</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,11 @@ | ||
{ | ||
"private": true, | ||
"scripts": { | ||
"dev": "rspack serve", | ||
"build": "rspack build" | ||
}, | ||
"devDependencies": { | ||
"@rspack/cli": "0.4.0", | ||
"unplugin-inject-preload": "workspace:*" | ||
} | ||
} |
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,72 @@ | ||
const rspack = require('@rspack/core') | ||
const UnpluginInjectPreload = require('unplugin-inject-preload/rspack').default | ||
// const HtmlWebpackPlugin = require('html-webpack-plugin') | ||
|
||
/** @type {import('@rspack/cli').Configuration} */ | ||
const config = { | ||
context: __dirname, | ||
entry: './../src/main.ts', | ||
output: { | ||
publicPath: 'dist', | ||
filename: 'main.js', | ||
path: 'dist', | ||
clean: true, | ||
assetModuleFilename: '[name].[hash][ext][query]', | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/i, | ||
type: 'css', | ||
}, | ||
{ | ||
test: /\.(woff|woff2|eot|ttf|otf)$/i, | ||
type: 'asset/resource', | ||
}, | ||
], | ||
}, | ||
plugins: [ | ||
new rspack.HtmlRspackPlugin({ | ||
minify: false, | ||
templateContent: ` | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<!--__unplugin-inject-preload__--> | ||
</head> | ||
<body> | ||
<h1>Hello World</h1> | ||
</body> | ||
</html>`, | ||
}), | ||
// new HtmlWebpackPlugin({ | ||
// inject: false, | ||
// minify: false, | ||
// templateContent: ({ htmlWebpackPlugin }) => ` | ||
// <!DOCTYPE html> | ||
// <html> | ||
// <head> | ||
// <!--__unplugin-inject-preload__--> | ||
// ${htmlWebpackPlugin.tags.headTags} | ||
// </head> | ||
// <body> | ||
// <h1>Hello World</h1> | ||
// ${htmlWebpackPlugin.tags.bodyTags} | ||
// </body> | ||
// </html> | ||
// `, | ||
// }), | ||
UnpluginInjectPreload({ | ||
injectTo: 'custom', | ||
files: [ | ||
{ | ||
outputMatch: /Roboto-[a-zA-Z]*.[a-z-0-9]*\.woff2$/, | ||
}, | ||
{ | ||
outputMatch: /^(?!main).*\.(css|js)$/, | ||
}, | ||
], | ||
}), | ||
], | ||
} | ||
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 |
---|---|---|
@@ -1,14 +1,15 @@ | ||
{ | ||
"type": "module", | ||
"private": true, | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "tsc && vite build", | ||
"preview": "vite preview" | ||
}, | ||
"devDependencies": { | ||
"typescript": "^5.2.2", | ||
"typescript": "^5.3.2", | ||
"unplugin-inject-preload": "workspace:*", | ||
"vite": "^4.4.9", | ||
"vite-plugin-inspect": "^0.7.38" | ||
"vite": "^5.0.2", | ||
"vite-plugin-inspect": "^0.7.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
Oops, something went wrong.