Created
July 21, 2019 15:24
-
-
Save kvnam/f5158eb060ac2e65baa8183abd6afc9c to your computer and use it in GitHub Desktop.
SSR Round One - Webpack Config
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
const path = require('path'); | |
// To prevent node_modules from being bundled into our final build file | |
const nodeExternals = require('webpack-node-externals'); | |
module.exports = { | |
entry: path.resolve(__dirname, 'server', 'server.js'), | |
output: { | |
path: path.resolve(__dirname, 'build'), | |
filename: 'server.js' | |
}, | |
target: 'node', | |
externals: [nodeExternals()], | |
module: { | |
rules: [ | |
{ | |
test: /\.js/, | |
loader: 'babel-loader', //Handles our Javascript files | |
exclude: /(node_modules)/ | |
}, | |
{ | |
test: /\.css$/, | |
use: [ | |
'css-loader' // For our CSS files | |
] | |
}, | |
{ | |
test: /\.(png|svg|jpg|gif)$/, | |
use: [ | |
'file-loader' //For any images | |
] | |
} | |
] | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment