Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add webpack ignore #6359

Merged
merged 1 commit into from
May 14, 2024
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
9 changes: 5 additions & 4 deletions utils/plugins/rollup-dynamic.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,18 @@ export function dynamicImportLegacyBrowserSupport() {
}

/**
* This rollup plugin transform code with import statements and adds a \/* vite-ignore *\/ comment to supress vite warnings
* This rollup plugin transform code with import statements and adds a \/* vite-ignore *\/ comment to suppress bundler warnings
* generated from dynamic-import-vars {@link https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars#limitations}
* {@link https://webpack.js.org/api/module-methods/#dynamic-expressions-in-import}
*
* @returns {import('rollup').Plugin} The rollup plugin
*/
export function dynamicImportViteSupress() {
export function dynamicImportBundlerSuppress() {
return {
name: 'dynamic-import-vite-suppress',
name: 'dynamic-import-bundler-suppress',
transform(code, id) {
return {
code: code.replace(/import\(([^'])/g, 'import(/* @vite-ignore */$1'),
code: code.replace(/import\(([^'])/g, 'import(/* @vite-ignore */ /* webpackIgnore: true */ $1'),
map: null
};
}
Expand Down
4 changes: 2 additions & 2 deletions utils/rollup-build-target.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { visualizer } from 'rollup-plugin-visualizer';
import { shaderChunks } from './plugins/rollup-shader-chunks.mjs';
import { engineLayerImportValidation } from './plugins/rollup-import-validation.mjs';
import { spacesToTabs } from './plugins/rollup-spaces-to-tabs.mjs';
import { dynamicImportLegacyBrowserSupport, dynamicImportViteSupress } from './plugins/rollup-dynamic.mjs';
import { dynamicImportLegacyBrowserSupport, dynamicImportBundlerSuppress } from './plugins/rollup-dynamic.mjs';
import { treeshakeIgnore } from './plugins/rollup-treeshake-ignore.mjs';

import { version, revision } from './rollup-version-revision.mjs';
Expand Down Expand Up @@ -236,7 +236,7 @@ function buildTarget({ moduleFormat, buildType, bundleState, input = 'src/index.
isDebug ? engineLayerImportValidation(input) : undefined,
!isDebug ? strip({ functions: STRIP_FUNCTIONS }) : undefined,
babel(babelOptions(isDebug, isUMD)),
!isUMD ? dynamicImportViteSupress() : undefined,
!isUMD ? dynamicImportBundlerSuppress() : undefined,
!isDebug ? spacesToTabs() : undefined
]
};
Expand Down