catamphetamine / universal-webpack

Isomorphic Webpack: both on client and server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Help with favicon

greyvugrin opened this issue · comments

I'm having some trouble getting a favicon to populate correctly in the client bundle.

It's required as follows:

const favicon = require('../images/favicon.png')

But the file gets bundled in the server folder of my build directory, and not the /assets folder.

Build structure:

dist/
|__server/
|__assets/

Also my webpack config uses:

// ...
output: {
    path: PATHS.build, // path.join(__dirname, 'dist/assets')
    publicPath: '/assets/',
    filename: "bundle_[hash].js",
    sourceMapFilename: "bundle_[hash].js.map"
  },

One thought I had was that since it's not required on the client side (the component it's used in is only required on the server), webpack wouldn't think to bundle it. The issue then becomes: how do I access things that are bundled in the server in my html?

One thought I had was that since it's not required on the client side (the component it's used in is only required on the server), webpack wouldn't think to bundle it

Of course.
Only require()d files are accessible.