luminaxster / syntax-highlighter

An extensible library to highlight (and comment) JSX syntax in the Monaco Editor using Babel. It exposes its AST, so you can add your own syntax-based or custom highlights.
https://luminaxster.github.io/syntax-highlighter/
MIT License
30 stars 4 forks source link

core.js:23 Uncaught ReferenceError: process is not defined #9

Closed xingxinglieo closed 2 years ago

xingxinglieo commented 2 years ago

I fllow the tutorial from npm,but an Error it is beacause of babel core use process.env.BABEL_TYPES_8_BREAKINGandprocess is not in the browser enviroment maybe the problem is i use vite and rolleup plugin ?code from rollup-plugin-monaco-editor

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import postcss from 'rollup-plugin-postcss'
import commonjs from '@rollup/plugin-commonjs'
import monaco from 'rollup-plugin-monaco-editor'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    postcss(),
    monaco({
      languages: ['javascript']
    }),
    nodeResolve(),
    commonjs()
  ],
  server: {
    host: '0.0.0.0',
    port: 8991,
    https: false
  }
})
luminaxster commented 2 years ago

Hi @xingxinglieo, could you share a pastebin to take a look at it? I'm not familiar with Vite and not sure when are you instantiating the higlighter.

luminaxster commented 2 years ago

Closing this meanwhile, please reopen if needed.