mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
adds composable HtmlRspackPlugin with Meteor support
This commit is contained in:
6
npm-packages/meteor-rspack/index.d.ts
vendored
6
npm-packages/meteor-rspack/index.d.ts
vendored
@@ -25,6 +25,12 @@ type MeteorEnv = Record<string, any> & {
|
||||
isReactEnabled: boolean;
|
||||
isBlazeEnabled: boolean;
|
||||
isBlazeHotEnabled: boolean;
|
||||
/**
|
||||
* A function that creates an instance of HtmlRspackPlugin with default options.
|
||||
* @param options - Optional configuration options that will be merged with defaults
|
||||
* @returns An instance of HtmlRspackPlugin
|
||||
*/
|
||||
HtmlRspackPlugin: (options?: HtmlRspackPluginOptions) => HtmlRspackPlugin;
|
||||
}
|
||||
|
||||
export type ConfigFactory = (
|
||||
|
||||
4
npm-packages/meteor-rspack/package-lock.json
generated
4
npm-packages/meteor-rspack/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@meteorjs/rspack",
|
||||
"version": "0.0.21",
|
||||
"version": "0.0.22",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@meteorjs/rspack",
|
||||
"version": "0.0.21",
|
||||
"version": "0.0.22",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"ignore-loader": "^0.1.2",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@meteorjs/rspack",
|
||||
"version": "0.0.21",
|
||||
"version": "0.0.22",
|
||||
"description": "Configuration logic for using Rspack in Meteor projects",
|
||||
"main": "index.js",
|
||||
"type": "module",
|
||||
|
||||
@@ -161,6 +161,28 @@ export default function (inMeteor = {}, argv = {}) {
|
||||
const buildOutputDir = path.resolve(process.cwd(), buildContext, outputDir);
|
||||
Meteor.buildOutputDir = buildOutputDir;
|
||||
|
||||
// Add HtmlRspackPlugin function to Meteor
|
||||
Meteor.HtmlRspackPlugin = (options = {}) => {
|
||||
return new HtmlRspackPlugin({
|
||||
inject: false,
|
||||
cache: true,
|
||||
filename: `../${buildContext}/${outputDir}/index.html`,
|
||||
templateContent: `
|
||||
<head>
|
||||
<% for tag in htmlRspackPlugin.tags.headTags { %>
|
||||
<%= toHtml(tag) %>
|
||||
<% } %>
|
||||
</head>
|
||||
<body>
|
||||
<% for tag in htmlRspackPlugin.tags.bodyTags { %>
|
||||
<%= toHtml(tag) %>
|
||||
<% } %>
|
||||
</body>
|
||||
`,
|
||||
...options
|
||||
});
|
||||
};
|
||||
|
||||
// Set watch options
|
||||
const watchOptions = {
|
||||
...defaultWatchOptions,
|
||||
@@ -291,23 +313,7 @@ export default function (inMeteor = {}, argv = {}) {
|
||||
banner: bannerOutput,
|
||||
entryOnly: true,
|
||||
}),
|
||||
new HtmlRspackPlugin({
|
||||
inject: false,
|
||||
cache: true,
|
||||
filename: `../${buildContext}/${outputDir}/index.html`,
|
||||
templateContent: `
|
||||
<head>
|
||||
<% for tag in htmlRspackPlugin.tags.headTags { %>
|
||||
<%= toHtml(tag) %>
|
||||
<% } %>
|
||||
</head>
|
||||
<body>
|
||||
<% for tag in htmlRspackPlugin.tags.bodyTags { %>
|
||||
<%= toHtml(tag) %>
|
||||
<% } %>
|
||||
</body>
|
||||
`,
|
||||
}),
|
||||
// Meteor.HtmlRspackPlugin(),
|
||||
],
|
||||
watchOptions,
|
||||
devtool: isDevEnvironment || isTest ? 'source-map' : 'hidden-source-map',
|
||||
|
||||
Reference in New Issue
Block a user