aurelia-react-loader icon indicating copy to clipboard operation
aurelia-react-loader copied to clipboard

Webpack support

Open aaronroberson opened this issue 9 years ago • 2 comments

Hello,

I'm trying to use this plugin within our Aurelia application. I'm using webpack as our bundler and have installed the aurelia-react-loader plugin via npm.

When I try to do the following: <require from='@nike/frame-component-library/src/components/nav/Nav.js!react-component'></require>

I get an error stating that the file cannot be found. However, if I drop the !react-component suffix the file is found but I get an Unexpected token error due to the JSX.

Any help would be appreciated, thanks!

aaronroberson avatar Sep 26 '16 03:09 aaronroberson

When I wrote this Webpack support in Aurelia was experimental, and I never got around to trying out the loader with it. I'd like to get it working, but I'm not sure when I'll have the time.

Are you able to import other resources without errors? One problem I see is the JSX thing. This loader doesn't run any transforms. You will need to compile any JSX with babel (probably via a webpack loader config) before running it through the react-component loader.

Sorry I don't have a better answer for you right now. If you discover any changes that could be made to better support webpack I'd be happy to take a PR.

bryanrsmith avatar Sep 26 '16 04:09 bryanrsmith

I am not using auelia-react-loader but I was able to make react work with Webpack/Aurelia. I detailed how in my wiki. https://github.com/allencoded/aurelia-react-skeleton/wiki/Aurelia-with-React-using-Webpack

allencoded avatar Sep 03 '17 07:09 allencoded