Skip to content

Commit

Permalink
fix #156
Browse files Browse the repository at this point in the history
  • Loading branch information
AsakuraMizu committed May 24, 2024
1 parent e68703b commit cce3837
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"remark-mdx-images": "^3.0.0",
"remark-unwrap-images": "^4.0.0",
"rollup-plugin-visualizer": "^5.12.0",
"rollup-preserve-directives": "^1.1.1",
"terser": "^5.30.0",
"typescript": "^5.4.3",
"unplugin-icons": "^0.18.5",
Expand Down
8 changes: 8 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineConfig } from 'vite';
import icons from 'unplugin-icons/vite';
import react from '@vitejs/plugin-react-swc';
import preserveDirectives from 'rollup-preserve-directives';
import { lingui } from '@lingui/vite-plugin';
import webExtension from '@samrum/vite-plugin-web-extension';
import { visualizer } from 'rollup-plugin-visualizer';
Expand Down Expand Up @@ -58,6 +59,7 @@ export default defineConfig({
},
icons({ compiler: 'jsx', jsx: 'react' }),
react({ plugins: [['@lingui/swc-plugin', {}]] }),
preserveDirectives(),
lingui(),
webExtension({
manifest: getManifest(isFirefox) as chrome.runtime.ManifestV3,
Expand Down Expand Up @@ -114,6 +116,12 @@ export default defineConfig({
'thu-learn-lib-vendor': ['thu-learn-lib'],
},
},
onwarn(warning, defaultHandler) {
if (warning.code === 'MODULE_LEVEL_DIRECTIVE' && warning.message.includes('use client')) {
return;
}
defaultHandler(warning);
},
},
},
});
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6573,6 +6573,13 @@ rollup-plugin-visualizer@^5.12.0:
source-map "^0.7.4"
yargs "^17.5.1"

rollup-preserve-directives@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/rollup-preserve-directives/-/rollup-preserve-directives-1.1.1.tgz#40d58b412ff791278ef06e0fa0944cbca3d6bd6d"
integrity sha512-+eQafbuEfDPfxQ9hQPlwaROfin4yiVRxap8hnrvvvcSGoukv1tTiYpAW9mvm3uR8J+fe4xd8FdVd5rz9q7jZ+Q==
dependencies:
magic-string "^0.30.5"

rollup@^4.13.0:
version "4.13.2"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.13.2.tgz#ac57d2dc48e8f5562f5a6daadb9caee590069262"
Expand Down

0 comments on commit cce3837

Please sign in to comment.