activewidgets / getlibs

OBSOLETE, DO NOT USE: This project is no longer maintained
MIT License
165 stars 12 forks source link

'react' library keeps trying to load from 'cdnjs.cloudflare.com' even when mapped to unpkg.com #5

Closed billiegoose closed 7 years ago

billiegoose commented 7 years ago

I'm trying to test out the latest and greatest React using a config like this:

  System.config({
    map: {
      'react': 'https://unpkg.com/react@16.0.0-beta.2/umd/react.development.js',
      'react-dom': 'https://unpkg.com/react-dom@16.0.0-beta.2/umd/react-dom.development.js'
    }
  })

react-dom loads fine I think, but I keep running into a 404 error with react:

https://cdnjs.cloudflare.com/ajax/libs/react/15.6.1@16.0.0-beta.2/umd/react.development.js

How come it starts with "https://cdnjs.cloudflare.com/ajax/libs/react/15.6.1" and how do I override that?

xkam commented 7 years ago

Looks like a bug in cdnjs plugin - by default the library is loaded from cdnjs if it is available there. As a workaround you can force js loader for the react script -

System.config({

    meta: {
        'react': {loader: 'js'}
    },

    map: {
        'react': 'https://unpkg.com/react@16.0.0-beta.2/umd/react.development.js',
        'react-dom': 'https://unpkg.com/react-dom@16.0.0-beta.2/umd/react-dom.development.js'
    }
})
billiegoose commented 7 years ago

Thanks @xkam that worked perfectly!