Skip to content

Instantly share code, notes, and snippets.

@jeffkamo
Created June 20, 2019 17:56
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/d06041e451d0d00bd27605459525fe56 to your computer and use it in GitHub Desktop.
Save jeffkamo/d06041e451d0d00bd27605459525fe56 to your computer and use it in GitHub Desktop.
// In your project's /web/webpack directory
/* eslint-env node */
/* eslint-disable import/no-commonjs */
const path = require('path')
module.exports = {
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')
}
}
}
]
}
}
// In your project's /web/webpack directory
// In the dependencies at the top, add...
const requestProcessorConfig = require('./base.request-processor')
// ...
// Where the configs are added together in an array, add
// `requestProcessorConfig` to it.
let configs = [mainConfig, loaderConfig, workerConfig, requestProcessorConfig]
// In your project's /web/webpack directory
// In the dependencies at the top, add...
const requestProcessorConfig = require('./base.request-processor')
// ...
// Where the configs are added together in an array, add
// `requestProcessorConfig` to it.
let configs = [
productionMainConfig,
baseLoaderConfig,
workerConfig,
requestProcessorConfig
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment