Last active
February 2, 2018 16:27
-
-
Save siakaramalegos/e83cf5b53d21ad535182911fa79e90a0 to your computer and use it in GitHub Desktop.
webpack.config.js favicon file loading snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// webpack.config.js favicon file loading snippet | |
const nodeModulesPath = path.resolve(__dirname, 'node_modules'); | |
const faviconsPath = path.resolve(__dirname, 'app/favicons/'); | |
// ... | |
const commonConfig = merge([{ | |
// ... | |
module: { | |
rules: [ | |
// Favicons - just pass through to root using same file name | |
{ | |
include: [faviconsPath], | |
use: [ | |
{ | |
loader: 'file-loader', | |
options: { name: '[name].[ext]' } | |
}, | |
], | |
}, | |
// Images other than favicons | |
{ | |
test: /\.(png|svg|jpg|gif)$/, | |
exclude: [nodeModulesPath, faviconsPath], | |
use: [ // ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment