I'm trying to make a CRUD system for XWiki objects and I'd like to use react-admin for it. Here's how XWiki docs say we can integrate libraries into XWiki: How to integrate React and XWiki?. Or here's an article for integrating javascript libraries in general: Integrating JavaScript Libraries.
Following the react tutorial, it says to do:
require.config({
paths: {
'react': 'https://unpkg.com/react@16/umd/react.production.min',
'react-dom': 'https://unpkg.com/react-dom@16/umd/react-dom.production.min'
}
})
define('likeButton', ['react'], function(React) {
'use strict';
...
That works and I get like button rendered:
But once I add:
require.config({
paths: {
'react': 'https://unpkg.com/react@16/umd/react.production.min',
'react-dom': 'https://unpkg.com/react-dom@16/umd/react-dom.production.min',
'react-admin': 'https://unpkg.com/[email protected]/dist/index.js'
}
})
define('likeButton', ['react', 'react-admin'], function(React, ReactAdmin) {
'use strict';
The like button isn't rendered anymore and I get error in the console:
require.min.js?r=1:5 Uncaught Error: Script error for "react-admin", needed by: likeButton
https://requirejs.org/docs/errors.html#scripterror
at makeError (require.min.js?r=1:5:1795)
at HTMLScriptElement.onScriptError (require.min.js?r=1:5:17084)