You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Module format "cjs" does not support top-level await. Use the "es" or "system" output formats rather.
file: D:/temp/siyuan-plugin-crdt/node_modules/.pnpm/[email protected]/node_modules/loro-wasm/bundler/loro_wasm_bg.wasm
Will commonJS support be considered in the future?
ps: I've used vite-plugin-wasm, vite-plugin-top-level-await
the following is my vite.config.ts : vite.config.ts
import{resolve}from"path"import{defineConfig,loadEnv}from"vite"importminimistfrom"minimist"import{viteStaticCopy}from"vite-plugin-static-copy"importlivereloadfrom"rollup-plugin-livereload"import{svelte}from"@sveltejs/vite-plugin-svelte"importzipPackfrom"vite-plugin-zip-pack";importfgfrom'fast-glob';importviteWasmfrom"vite-plugin-wasm";importtopLevelAwaitfrom"vite-plugin-top-level-await";import{wasm}from"@rollup/plugin-wasm"constargs=minimist(process.argv.slice(2))constisWatch=args.watch||args.w||falseconstdevDistDir="./dev"constdistDir=isWatch ? devDistDir : "./dist"console.log("isWatch=>",isWatch)console.log("distDir=>",distDir)exportdefaultdefineConfig({resolve: {alias: {"@": resolve(__dirname,"src"),}},plugins: [svelte(),viteStaticCopy({targets: [{src: "./README*.md",dest: "./",},{src: "./icon.png",dest: "./",},{src: "./preview.png",dest: "./",},{src: "./plugin.json",dest: "./",},{src: "./src/i18n/**",dest: "./i18n/",},],}),viteWasm(),topLevelAwait(),],// https://github.com/vitejs/vite/issues/1930// https://vitejs.dev/guide/env-and-mode.html#env-files// https://github.com/vitejs/vite/discussions/3058#discussioncomment-2115319// 在这里自定义变量define: {"process.env.DEV_MODE": `"${isWatch}"`,},build: {// 输出路径outDir: distDir,emptyOutDir: false,// 构建后是否生成 source map 文件sourcemap: false,// 设置为 false 可以禁用最小化混淆// 或是用来指定是应用哪种混淆器// boolean | 'terser' | 'esbuild'// 不压缩,用于调试minify: !isWatch,lib: {// Could also be a dictionary or array of multiple entry pointsentry: resolve(__dirname,"src/index.ts"),// the proper extensions will be addedfileName: "index",formats: ["cjs"],},rollupOptions: {plugins: [
...(isWatch ? [livereload(devDistDir),{//监听静态资源文件name: 'watch-external',asyncbuildStart(){constfiles=awaitfg(['src/i18n/*.json','./README*.md','./plugin.json']);for(letfileoffiles){this.addWatchFile(file);}}}] : [zipPack({inDir: './dist',outDir: './',outFileName: 'package.zip'})])],// make sure to externalize deps that shouldn't be bundled// into your libraryexternal: ["siyuan","process"],output: {entryFileNames: "[name].js",assetFileNames: (assetInfo)=>{if(assetInfo.name==="style.css"){return"index.css"}returnassetInfo.name},},},}})
Finally, thank you for making such a great library.
The text was updated successfully, but these errors were encountered:
The following error message is displayed:
Will commonJS support be considered in the future?
ps: I've used vite-plugin-wasm, vite-plugin-top-level-await
the following is my vite.config.ts :
vite.config.ts
Finally, thank you for making such a great library.
The text was updated successfully, but these errors were encountered: