Skip to content

Commit a6cf4cc

Browse files
authored
Merge pull request #36 from repixelcorp/feature/migrate-to-rolldown
New canary release (0.3.0)
2 parents cb303ef + 08355b7 commit a6cf4cc

File tree

8 files changed

+676
-537
lines changed

8 files changed

+676
-537
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
A faster, more modern, superior alternative for [Mendix PWT](https://github.com/mendix/widgets-tools).
66

7-
## How to use?
7+
## How to migration to hyper-pwt?
88

9-
It's simple.
9+
Bascially, hyper-pwt is a drop-in replacement for Mendix PWT.
1010

1111
First, install hyper-pwt from npm.
1212

@@ -29,6 +29,12 @@ Second, replace pluggable-widgets-tools to hyper-pwt in widget's package.json.
2929
}
3030
```
3131

32+
### I use custom rollup configuration.
33+
34+
First, proceed with the basic replacement process.
35+
36+
If the widget does not function properly after installing hyper-pwt, you can customize your Vite configuration by referring to the [“Custom build configurations”](#custom-build-configurations) section.
37+
3238
## Custom build configurations
3339

3440
### Web

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@repixelcorp/hyper-pwt",
3-
"version": "0.2.0",
3+
"version": "0.3.0",
44
"description": "A faster, more modern, superior alternative for Mendix PWT.",
55
"repository": {
66
"type": "git",
@@ -38,17 +38,16 @@
3838
"devDependencies": {
3939
"@rslib/core": "0.12.2",
4040
"@types/node": "22.17.2",
41-
"esbuild": "0.25.9",
4241
"type-fest": "4.41.0",
4342
"typescript": "5.9.2"
4443
},
4544
"dependencies": {
46-
"@vitejs/plugin-react-swc": "4.0.1",
45+
"@vitejs/plugin-react": "5.0.2",
4746
"chalk": "5.6.0",
4847
"commander": "14.0.0",
4948
"fast-xml-parser": "5.2.5",
5049
"mendix": "10.24.77222",
51-
"vite": "7.1.3",
50+
"vite": "npm:rolldown-vite@7.1.5",
5251
"zip-a-folder": "3.1.9"
5352
},
5453
"files": [

pnpm-lock.yaml

Lines changed: 644 additions & 324 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/commands/start/web/index.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import getWidgetName from '../../../utils/getWidgetName';
1212
import getViteUserConfiguration from '../../../utils/getViteUserConfiguration';
1313
import { generateTypesFromFile } from '../../../type-generator';
1414
import { mendixHotreloadReactPlugin } from '../../../configurations/vite/plugins/mendix-hotreload-react-plugin';
15-
import { mendixHotreloadReactEsbuildPlugin } from '../../../configurations/vite/plugins/mendix-hotreload-react-esbuild-plugin';
1615
import { mendixPatchViteClientPlugin } from '../../../configurations/vite/plugins/mendix-patch-vite-client-plugin';
1716

1817
const generateTyping = async () => {
@@ -71,13 +70,6 @@ const startWebCommand = async () => {
7170
interval: 100
7271
},
7372
},
74-
optimizeDeps: {
75-
esbuildOptions: {
76-
plugins: [
77-
mendixHotreloadReactEsbuildPlugin(),
78-
],
79-
}
80-
},
8173
plugins: [
8274
...resultViteConfig.plugins as PluginOption[],
8375
mendixHotreloadReactPlugin(),

src/configurations/vite/index.ts

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { UserConfig } from "vite";
2-
import react from '@vitejs/plugin-react-swc';
2+
import react from '@vitejs/plugin-react';
33
import path from "path";
44

55
import getWidgetName from "../../utils/getWidgetName";
@@ -14,7 +14,7 @@ export const getEditorConfigDefaultConfig = async (isProduction: boolean): Promi
1414
plugins: [],
1515
build: {
1616
outDir: WEB_OUTPUT_DIRECTORY,
17-
minify: isProduction ? 'esbuild' : false,
17+
minify: isProduction ? true : false,
1818
emptyOutDir: false,
1919
sourcemap: isProduction ? false : true,
2020
lib: {
@@ -33,14 +33,16 @@ export const getEditorPreviewDefaultConfig = async (isProduction: boolean): Prom
3333
const widgetName = await getWidgetName();
3434

3535
return {
36-
plugins: [react()],
36+
plugins: [react({
37+
jsxRuntime: 'classic'
38+
})],
3739
define: {
3840
'process.env': {},
3941
'process.env.NODE_ENV': '"production"'
4042
},
4143
build: {
4244
outDir: WEB_OUTPUT_DIRECTORY,
43-
minify: isProduction ? 'esbuild' : false,
45+
minify: isProduction ? true : false,
4446
emptyOutDir: false,
4547
sourcemap: isProduction ? false : true,
4648
lib: {
@@ -51,8 +53,8 @@ export const getEditorPreviewDefaultConfig = async (isProduction: boolean): Prom
5153
},
5254
formats: ['umd']
5355
},
54-
rollupOptions: {
55-
external: ['react', 'react-dom', 'react-dom/client'],
56+
rolldownOptions: {
57+
external: ['react', 'react-dom', 'react-dom/client', 'react/jsx-runtime', 'react/jsx-dev-runtime'],
5658
output: {
5759
globals: {
5860
react: 'React',
@@ -70,15 +72,20 @@ export const getViteDefaultConfig = async (isProduction: boolean, userCustomConf
7072
const viteOutputDirectory = await getViteOutputDirectory();
7173

7274
return {
73-
plugins: [react(userCustomConfig?.reactPluginOptions || undefined)],
75+
plugins: [
76+
react({
77+
...userCustomConfig?.reactPluginOptions || {},
78+
jsxRuntime: 'classic'
79+
})
80+
],
7481
define: {
7582
'process.env': {},
7683
'process.env.NODE_ENV': isProduction ? '"production"' : '"development"'
7784
},
7885
build: {
7986
outDir: viteOutputDirectory,
80-
minify: isProduction ? 'esbuild' : false,
81-
cssMinify: isProduction ? 'esbuild' : false,
87+
minify: isProduction ? true : false,
88+
cssMinify: isProduction ? true : false,
8289
sourcemap: isProduction ? false : true,
8390
lib: {
8491
formats: isProduction ? ['umd'] : ['es', 'umd'],
@@ -97,8 +104,8 @@ export const getViteDefaultConfig = async (isProduction: boolean, userCustomConf
97104
},
98105
cssFileName: widgetName
99106
},
100-
rollupOptions: {
101-
external: ['react', 'react-dom', 'react-dom/client'],
107+
rolldownOptions: {
108+
external: ['react', 'react-dom', 'react-dom/client', 'react/jsx-runtime', 'react/jsx-dev-runtime'],
102109
output: {
103110
globals: {
104111
react: 'React',

src/configurations/vite/plugins/mendix-hotreload-react-esbuild-plugin.ts

Lines changed: 0 additions & 186 deletions
This file was deleted.

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { UserConfig } from "vite";
2-
import reactPlugin from "@vitejs/plugin-react-swc";
2+
import reactPlugin from "@vitejs/plugin-react";
33

44
export type PWTConfig = UserConfig & {
55
reactPluginOptions?: Parameters<typeof reactPlugin>[0];

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"esModuleInterop": true,
77
"lib": ["ESNext"],
88
"module": "preserve",
9-
"moduleResolution": "bundler"
9+
"moduleResolution": "bundler",
10+
"target": "esnext"
1011
},
1112
}

0 commit comments

Comments
 (0)