Skip to content

Instantly share code, notes, and snippets.

@jeffkamo
Last active June 20, 2019 18:07
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 jeffkamo/f9c8162471374c188bb881ebc8cad14a to your computer and use it in GitHub Desktop.
Save jeffkamo/f9c8162471374c188bb881ebc8cad14a to your computer and use it in GitHub Desktop.
// ...
// Near the bottom of the file, before the `module.exports`,
// paste in the following code:
const requestProcessor = Object.assign(
{},
{
entry: './app/request-processor.js',
target: 'node',
output: {
path: path.resolve(process.cwd(), 'build'),
filename: 'request-processor.js',
// Output a CommonJS module for use in Node
libraryTarget: 'commonjs2'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
cacheDirectory: path.join(__dirname, 'tmp')
}
}
}
]
}
}
)
// Modify the module.export to include the new `requestProcessor` object
module.exports = [main, others, ssrServerConfig, requestProcessor]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment