Skip to content

Instantly share code, notes, and snippets.

@jkinkead
Created October 19, 2018 00:29
Show Gist options
  • Save jkinkead/4f8064d62d3a56a132e20bc9379efc53 to your computer and use it in GitHub Desktop.
Save jkinkead/4f8064d62d3a56a132e20bc9379efc53 to your computer and use it in GitHub Desktop.
Webpack for a React application in the cloud
const path = require('path')
const webpack = require('webpack')
const nodeExternals = require("webpack-node-externals")
module.exports = {
target: 'node',
node: {
__dirname: false
},
entry: ['./index.js'],
externals: [nodeExternals()],
output: {
libraryTarget: "commonjs",
filename: 'index.js'
},
mode: "development",
module: {
rules: [{
test: /.js$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env', '@babel/react']
}
}
]
}]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment