jcoreio / crater

Meteor/Webpack/React SSR app skeleton that runs your app code outside of Meteor Isobuild
ISC License
82 stars 10 forks source link

Managing static assets (images, etc) #51

Closed evelant closed 7 years ago

evelant commented 7 years ago

@jedwards1211 How would you recommend handling static assets in development and production with this setup?

I am porting my meteor app to this architecture and I have an existing folder full of assorted images which were previously served up by meteor in the public folder. It looks like I could use https://github.com/webpack/file-loader which would require some refactoring or I could add a route to server/index.js. I am not sure what is the best course of action or if I am missing a better way of doing it.

jedwards1211 commented 7 years ago

Yeah try file-loader or url-loader. I don't have too much experience with them but they should work.

darkadept commented 7 years ago

Yup, @jedwards1211 is right. This is what I do:

<img src={require('./myimage.png')} alt="My Image"/>
jedwards1211 commented 7 years ago

I'm going ahead and closing this. @fignuts if you run into any issues using static assets with this skeleton, feel free to let me know in a new issue.