Coder Social home page Coder Social logo

Comments (14)

sarsamurmu avatar sarsamurmu commented on May 27, 2024 1

Oh, My bad. It needs a minor fix to the CSS plugin to work. So I can't do anything until I get my monitor back. Sorry.

from reboost.

sarsamurmu avatar sarsamurmu commented on May 27, 2024 1

Fixed in v0.18.2. Update your installation of Reboost.

from reboost.

sarsamurmu avatar sarsamurmu commented on May 27, 2024

If you look at the package.json of @monaco-editor/react you can see that prop-types is a peerDependency, so it means you have to manually install it. Please install it in your project using

npm i prop-types
# or
yarn add prop-types

from reboost.

jet10000 avatar jet10000 commented on May 27, 2024

thank you.

from reboost.

jet10000 avatar jet10000 commented on May 27, 2024

I don’t know what happened, I tried to solve it myself, but I don’t know how to deal with it.

suren-atoyan/monaco-react#139

image

image

from reboost.

sarsamurmu avatar sarsamurmu commented on May 27, 2024

In your template include these

<script type="module" src="{{PATH_TO_SCRIPT}}"></script>
<script nomodule src="{{PATH_TO_SCRIPT}}"></script>

Both are required. Hope it fixes the issue.

from reboost.

jet10000 avatar jet10000 commented on May 27, 2024

no effect

image

from reboost.

sarsamurmu avatar sarsamurmu commented on May 27, 2024

This is caused by CommonJS modules. Can you try adding this to your options

start({
  // ... other options

  commonJSInterop: {
    mode: 1
  }
})

from reboost.

jet10000 avatar jet10000 commented on May 27, 2024

image

image

image

from reboost.

sarsamurmu avatar sarsamurmu commented on May 27, 2024

Actually, CommonJS interoperability with ES modules is a complex thing. I guess I have to rewrite the transformer code to support it. Until then all you can do is wait.

from reboost.

sarsamurmu avatar sarsamurmu commented on May 27, 2024

It looks like the problem comes from @monaco-editor/react. It created an import mess in its code which's why Reboost can't optimize it to work with ES Modules. I tried react-monaco-editor and it's working fine with some configuration.

Files

  • reboost.js
    const { start, builtInPlugins: { UsePlugin, FilePlugin } } = require('reboost');
    
    start({
      entries: [
        ['./src/index.jsx', './public/dist/index.js']
      ],
      commonJSInterop: {
        mode: 1
      },
      plugins: [
        // For loading fonts
        UsePlugin({
          include: /\.ttf/i,
          use: FilePlugin()
        })
      ],
    })
  • src/index.js
    import React from "react";
    import ReactDOM from "react-dom";
    
    import MonacoEditor from "react-monaco-editor";
    
    const App = () => <MonacoEditor height="90vh" language="javascript" />;
    
    const monacoElement = document.getElementById("monaco");
    ReactDOM.render(<App />, monacoElement);

So you can just use react-monaco-editor instead of @monaco-editor/react. There's no other way to fix this in Reboost.

from reboost.

jet10000 avatar jet10000 commented on May 27, 2024

I adjusted it according to your code and tested it, but it still doesn't work. Can you add an example to the playground?

from reboost.

jet10000 avatar jet10000 commented on May 27, 2024

image

from reboost.

jet10000 avatar jet10000 commented on May 27, 2024

if enable commonJSInterop mode:1

image

from reboost.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.