izaera / liferay-npm-examples

[DEPRECATED: see README] Examples showing how to use Liferay Portal's NPM support
6 stars 8 forks source link

Could not make it work #1

Closed galiatsatosc closed 7 years ago

galiatsatosc commented 7 years ago

I downloaded this workspace with a bundled tomcat server. I build the react-example, angular-example and vue-example modules successfully.

But when i add the modules to a page i get a timeout error "Error: Load timeout for modules: liferay-npm-example-react@1.0.0"

It seems to me that this repository misses something. I already added Include-Resource: package.json to the bnd.bnd but it seems that there is no record in Liferay.MODULES.

galiatsatosc commented 7 years ago

I manage to make the react-example work, but with many modifications even in the liferay-npm-bundler node module cause apparently you dont need the Liferay.Loader.addModule in every js copied from nome_modules folder since the portal dont loads all this js files automatically and modules named like './react@15.6.1/react' are not ideal. In the end i used the config.js to defined Liferay.Loader.addModule( { dependencies: [], name: 'react', anonymous: true, path: MODULE_PATH + '/node_modules/react@15.6.1/dist/react.min.js' } ); Liferay.Loader.addModule( { dependencies: ['react'], name: 'react-dom', anonymous: true, path: MODULE_PATH + '/node_modules/react-dom@15.6.1/dist/react-dom.min.js' } );

and the gradle transpileJS { bundleFileName = "js/reactExample.js" globalName = "reactExample" modules = "globals" srcIncludes = "*/.jsx" } only for the react's .jsx files. Also i added

"metal-cli": "^2.0.0"

in package.json.

izaera commented 7 years ago

Oops. This project if only meant to work in the current development version of Liferay portal as it is a work in progress for the next version. It won't work in Liferay 7.

Sorry for the misunderstanding and the inconveniences it may have caused :-(