Skip to content

Instantly share code, notes, and snippets.

@adamrunner
Created June 10, 2018 17:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamrunner/3b6554e0289521ae7591d8d536acd368 to your computer and use it in GitHub Desktop.
Save adamrunner/3b6554e0289521ae7591d8d536acd368 to your computer and use it in GitHub Desktop.
Example webpack config file for adding asset processing, allows import of CSS, Fonts, Data
// Webpack Config File
// Allows import of:
// CSS styles
// Fonts
// CSV/TSV data
// XML data
const path = require('path');
module.exports = {
entry: './src/index.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
},
module: {
rules: [
{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
]
},
{
test: /\.(png|svg|jpg|gif)$/,
use: 'file-loader'
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/,
use: 'file-loader'
},
{
test: /\.(csv|tsv)$/,
use: 'csv-loader'
},
{
test: /\.xml$/,
use: 'xml-loader'
}
]
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment