Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

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

## How to use?
## How to migration to hyper-pwt?

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

First, install hyper-pwt from npm.

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

### I use custom rollup configuration.

First, proceed with the basic replacement process.

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.

## Custom build configurations

### Web
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@repixelcorp/hyper-pwt",
"version": "0.2.0",
"version": "0.3.0",
"description": "A faster, more modern, superior alternative for Mendix PWT.",
"repository": {
"type": "git",
Expand Down Expand Up @@ -38,17 +38,16 @@
"devDependencies": {
"@rslib/core": "0.12.2",
"@types/node": "22.17.2",
"esbuild": "0.25.9",
"type-fest": "4.41.0",
"typescript": "5.9.2"
},
"dependencies": {
"@vitejs/plugin-react-swc": "4.0.1",
"@vitejs/plugin-react": "5.0.2",
"chalk": "5.6.0",
"commander": "14.0.0",
"fast-xml-parser": "5.2.5",
"mendix": "10.24.77222",
"vite": "7.1.3",
"vite": "npm:rolldown-vite@7.1.5",
"zip-a-folder": "3.1.9"
},
"files": [
Expand Down
968 changes: 644 additions & 324 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

8 changes: 0 additions & 8 deletions src/commands/start/web/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import getWidgetName from '../../../utils/getWidgetName';
import getViteUserConfiguration from '../../../utils/getViteUserConfiguration';
import { generateTypesFromFile } from '../../../type-generator';
import { mendixHotreloadReactPlugin } from '../../../configurations/vite/plugins/mendix-hotreload-react-plugin';
import { mendixHotreloadReactEsbuildPlugin } from '../../../configurations/vite/plugins/mendix-hotreload-react-esbuild-plugin';
import { mendixPatchViteClientPlugin } from '../../../configurations/vite/plugins/mendix-patch-vite-client-plugin';

const generateTyping = async () => {
Expand Down Expand Up @@ -71,13 +70,6 @@ const startWebCommand = async () => {
interval: 100
},
},
optimizeDeps: {
esbuildOptions: {
plugins: [
mendixHotreloadReactEsbuildPlugin(),
],
}
},
plugins: [
...resultViteConfig.plugins as PluginOption[],
mendixHotreloadReactPlugin(),
Expand Down
29 changes: 18 additions & 11 deletions src/configurations/vite/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { UserConfig } from "vite";
import react from '@vitejs/plugin-react-swc';
import react from '@vitejs/plugin-react';
import path from "path";

import getWidgetName from "../../utils/getWidgetName";
Expand All @@ -14,7 +14,7 @@ export const getEditorConfigDefaultConfig = async (isProduction: boolean): Promi
plugins: [],
build: {
outDir: WEB_OUTPUT_DIRECTORY,
minify: isProduction ? 'esbuild' : false,
minify: isProduction ? true : false,
emptyOutDir: false,
sourcemap: isProduction ? false : true,
lib: {
Expand All @@ -33,14 +33,16 @@ export const getEditorPreviewDefaultConfig = async (isProduction: boolean): Prom
const widgetName = await getWidgetName();

return {
plugins: [react()],
plugins: [react({
jsxRuntime: 'classic'
})],
define: {
'process.env': {},
'process.env.NODE_ENV': '"production"'
},
build: {
outDir: WEB_OUTPUT_DIRECTORY,
minify: isProduction ? 'esbuild' : false,
minify: isProduction ? true : false,
emptyOutDir: false,
sourcemap: isProduction ? false : true,
lib: {
Expand All @@ -51,8 +53,8 @@ export const getEditorPreviewDefaultConfig = async (isProduction: boolean): Prom
},
formats: ['umd']
},
rollupOptions: {
external: ['react', 'react-dom', 'react-dom/client'],
rolldownOptions: {
external: ['react', 'react-dom', 'react-dom/client', 'react/jsx-runtime', 'react/jsx-dev-runtime'],
output: {
globals: {
react: 'React',
Expand All @@ -70,15 +72,20 @@ export const getViteDefaultConfig = async (isProduction: boolean, userCustomConf
const viteOutputDirectory = await getViteOutputDirectory();

return {
plugins: [react(userCustomConfig?.reactPluginOptions || undefined)],
plugins: [
react({
...userCustomConfig?.reactPluginOptions || {},
jsxRuntime: 'classic'
})
],
define: {
'process.env': {},
'process.env.NODE_ENV': isProduction ? '"production"' : '"development"'
},
build: {
outDir: viteOutputDirectory,
minify: isProduction ? 'esbuild' : false,
cssMinify: isProduction ? 'esbuild' : false,
minify: isProduction ? true : false,
cssMinify: isProduction ? true : false,
sourcemap: isProduction ? false : true,
lib: {
formats: isProduction ? ['umd'] : ['es', 'umd'],
Expand All @@ -97,8 +104,8 @@ export const getViteDefaultConfig = async (isProduction: boolean, userCustomConf
},
cssFileName: widgetName
},
rollupOptions: {
external: ['react', 'react-dom', 'react-dom/client'],
rolldownOptions: {
external: ['react', 'react-dom', 'react-dom/client', 'react/jsx-runtime', 'react/jsx-dev-runtime'],
output: {
globals: {
react: 'React',
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { UserConfig } from "vite";
import reactPlugin from "@vitejs/plugin-react-swc";
import reactPlugin from "@vitejs/plugin-react";

export type PWTConfig = UserConfig & {
reactPluginOptions?: Parameters<typeof reactPlugin>[0];
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"esModuleInterop": true,
"lib": ["ESNext"],
"module": "preserve",
"moduleResolution": "bundler"
"moduleResolution": "bundler",
"target": "esnext"
},
}
Loading