Skip to content

Commit

Permalink
build(editor): Improve browser support for the n8n editor (#12064)
Browse files Browse the repository at this point in the history
  • Loading branch information
elsmr authored Dec 10, 2024
1 parent 5fc3bf6 commit a50969b
Show file tree
Hide file tree
Showing 4 changed files with 1,576 additions and 299 deletions.
6 changes: 3 additions & 3 deletions packages/editor-ui/.browserslistrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
> 1%
last 2 versions
not ie <= 8
defaults
cover 95% in US
cover 95% in alt-EU and last 2 years and not dead and fully supports es6-module and fully supports es6-module-dynamic-import
2 changes: 2 additions & 0 deletions packages/editor-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@
"@types/lodash-es": "^4.17.6",
"@types/luxon": "^3.2.0",
"@types/uuid": "catalog:",
"@vitejs/plugin-legacy": "^6.0.0",
"@vitejs/plugin-vue": "catalog:frontend",
"@vitest/coverage-v8": "catalog:frontend",
"browserslist-to-esbuild": "^2.1.1",
"miragejs": "^0.1.48",
"unplugin-icons": "^0.19.0",
"unplugin-vue-components": "^0.27.2",
Expand Down
11 changes: 11 additions & 0 deletions packages/editor-ui/vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@ import { vitestConfig } from '../design-system/vite.config.mts';
import icons from 'unplugin-icons/vite';
import iconsResolver from 'unplugin-icons/resolver';
import components from 'unplugin-vue-components/vite';
import browserslistToEsbuild from 'browserslist-to-esbuild';
import legacy from '@vitejs/plugin-legacy';
import browserslist from 'browserslist';

const publicPath = process.env.VUE_APP_PUBLIC_PATH || '/';

const { NODE_ENV } = process.env;

const browsers = browserslist.loadConfig({ path: process.cwd() });

const alias = [
{ find: '@', replacement: resolve(__dirname, 'src') },
{ find: 'stream', replacement: 'stream-browserify' },
Expand Down Expand Up @@ -54,6 +59,11 @@ const plugins = [
],
}),
vue(),
legacy({
modernTargets: browsers,
modernPolyfills: true,
renderLegacyChunks: false,
}),
];

const { RELEASE: release } = process.env;
Expand All @@ -80,6 +90,7 @@ export default mergeConfig(
build: {
minify: !!release,
sourcemap: !!release,
target: browserslistToEsbuild(browsers),
},
}),
vitestConfig,
Expand Down
Loading

0 comments on commit a50969b

Please sign in to comment.