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

Usage without npm #142

Open
pikilon opened this issue Dec 8, 2019 · 1 comment
Open

Usage without npm #142

pikilon opened this issue Dec 8, 2019 · 1 comment

Comments

@pikilon
Copy link

pikilon commented Dec 8, 2019

Is there any documentation about how to load the plugin from a CDN?
I am trying this

  <script src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.js"></script>
  <script src="//cdnjs.cloudflare.com/ajax/libs/require-text/2.0.12/text.js"></script>

and in the console I am getting this error
Error: Mismatched anonymous define() module: function (module) {...

It is hard to find how to load the plugins, it will be nice if requirejs can add them in the .config

Thanks for the help

@manikantag
Copy link

In my case, adding a path entry in requirejs.config fixed.

TLDR: Don't include text.js script tag anywhere else. Either you use optimizer to bundle both requirejs & plugin, or load the plugins via requirejs itself.

requirejs.config({
    paths: {
        // text: './vendor/text', // <----- from local copy, or
        text: 'https://cdn.jsdelivr.net/npm/[email protected]/text.min'  // <----- from any CDN (mind the missing `.js` extension)
    }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants