Skip to content
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

How to use it on browserify #95

Closed
mimorisuzuko opened this issue Aug 4, 2016 · 7 comments
Closed

How to use it on browserify #95

mimorisuzuko opened this issue Aug 4, 2016 · 7 comments

Comments

@mimorisuzuko
Copy link

When I try to use it on browserify(gulp-browserify), other modules is not imported.
I think require is overwritten by loader.js.

I ask you to how to use it on browserify correctly.

@joelday
Copy link

joelday commented Aug 9, 2016

Agreed, I'd like to be able to bundle this so that everything can be loaded synchronously and so the bundle can be limited to the specific dependencies that I want.

@mimorisuzuko
Copy link
Author

mimorisuzuko commented Aug 16, 2016

For example, you can rename loader.js require?
e.g.) require -> _require
It is possible to prevent a conflict of require function.

@qballer
Copy link

qballer commented Aug 16, 2016

Maybe you can draw ideas from #40, it's a webpack discussion but it might help.

@intellild
Copy link

rename loader.js require is a good idea
webpack bundle require into one file, but loader.js require should be running dynamicly at runtime

@mimorisuzuko
Copy link
Author

Fixed by #18?

@yuanliwei
Copy link

In my case, I just replaced require with window['require'], and it worked.

<script src="https://cdn.bootcss.com/monaco-editor/0.17.1/min/vs/loader.js"></script>
window['require'].config({ paths: { 'vs': 'https://cdn.bootcss.com/monaco-editor/0.17.1/min/vs' } })
window['require'](['vs/editor/editor.main'], function () {
    const monaco = window.monaco || require('monaco-editor'); // for IntelliSense
    var editor = monaco.editor.create(document.querySelector('.editor-container'), {
        language: "javascript",
        roundedSelection: false,
        scrollBeyondLastLine: false,
        readOnly: false,
        theme: "vs",
        fontSize: 20,
    });
});

@jamesgibson14
Copy link

Thanks @yuanliwei your solution worked for me only I changed the cdn url to unpkg:
https://unpkg.com/monaco-editor@0.18.1/min/vs/loader.js

@vscodebot vscodebot bot locked and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants