-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Inline worker build without any output files or error message. #1927
Comments
Additional: Using dev: it works Using dev: it works too |
In my case, the above error is resolved by // vite.config.js
import { defineConfig } from 'vite';
const prefix = `monaco-editor/esm/vs`;
export default defineConfig({
build: {
rollupOptions: {
output: {
manualChunks: {
jsonWorker: [`${prefix}/language/json/json.worker`],
cssWorker: [`${prefix}/language/css/css.worker`],
htmlWorker: [`${prefix}/language/html/html.worker`],
tsWorker: [`${prefix}/language/typescript/ts.worker`],
editorWorker: [`${prefix}/editor/editor.worker`],
},
},
},
},
}); |
I see this has the p2-has-workaround label, is that because someone has managed to get rollup to output files in the inline case with minify:terser? My current resolution involves using manualChunks:{} and minify:esbuild along with a patch to get the bundle to work in firefox or safari. I would love to be able to simplify that and use rollup and terser for minification |
Is there still a working workaround for this? I added the rollup options, and I added Here are my deps
|
I think the original issue has been resolved in Vite 2.4. @Blakeinstein Yes, Vite no longer needs almost any workarounds for monaco-editor (last I checked, we still needed to disable the vendor chunking). Is that error in production mode in Firefox? In development, you must be using Chrome for workers. You might try asking here if you are still running into trouble. |
I have the same problem: Upgrade to: yarn add vite@^2.4.4 @vitejs/plugin-vue@^1.4.0 -D Error log:
|
I dont know really, created a new vite vue project, (around the same time as this example). |
I found a new solution:If you use CDN, you can ignore this step: import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import jsx from '@vitejs/plugin-vue-jsx'
import copy from 'rollup-plugin-copy'
export default defineConfig({
build: {
rollupOptions: {
plugins: [
copy({
targets: [
{
src: 'node_modules/monaco-editor/min/vs/**/*',
dest: 'dist/assets/monaco-editor/vs',
},
],
hook: 'writeBundle',
}),
],
},
},
plugins: [vue(), jsx()],
}) Core code: import { onMounted } from 'vue';
import loader from '@monaco-editor/loader'
loader.config({ paths: { vs: '/assets/monaco-editor/vs' } })
or
loader.config({ paths: { vs: 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.27.0/min/vs' } })
onMounted(async () => {
const monaco = await loader.init()
monaco.editor.create(dom, {})
});
|
I test in [email protected], it can work now. Can I close this issues? |
@poyoho OK |
Describe the bug
I am using monaco editor with inline worker, vite build output nothing. (exit at
✓ 739 modules transformed.
)(When I used vite 1, it worked as expected.
Reproduction
https://github.com/meowtec/vite-worker-bug-reproduce
System Info
vite
version: 2.0.0-beta.65Logs (Optional if provided reproduction)
The text was updated successfully, but these errors were encountered: