Skip to content

Instantly share code, notes, and snippets.

@webhacking
Created September 18, 2019 06:29
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 webhacking/aa1b99fe2e6b028cd87f4ea818a81113 to your computer and use it in GitHub Desktop.
Save webhacking/aa1b99fe2e6b028cd87f4ea818a81113 to your computer and use it in GitHub Desktop.
// const webpack = require('webpack');
const path = require('path');
const nodeExternals = require('webpack-node-externals');
const slsw = require('serverless-webpack');
const isLocal = slsw.lib.webpack.isLocal;
module.exports = {
mode: isLocal ? 'development' : 'production',
// entry: slsw.lib.entries,
entry: './src/main.ts',
target: 'node',
devtool: 'source-map',
externals: [nodeExternals()],
node: {
__dirname: true,
},
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
loader: 'ts-loader'
}
],
},
optimization: {
removeAvailableModules: false,
removeEmptyChunks: false,
splitChunks: false,
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
modules: [path.resolve('./src'), 'node_modules']
},
output: {
libraryTarget: 'commonjs',
// path: path.join(__dirname, '.webpack'),
path: path.join(__dirname, 'dist'),
filename: '[name].js',
pathinfo: false
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment