|
| 1 | +const path = require('path') |
| 2 | +const nodeExternals = require('webpack-node-externals') |
| 3 | +const slsw = require('serverless-webpack') |
| 4 | +const entries = {} |
| 5 | + |
| 6 | +Object.keys(slsw.lib.entries).forEach( |
| 7 | + key => (entries[key] = ['./source-map-install.js', slsw.lib.entries[key]]) |
| 8 | +) |
| 9 | +module.exports = { |
| 10 | + mode: slsw.lib.webpack.isLocal ? 'development' : 'production', |
| 11 | + devtool: 'source-map', |
| 12 | + // devtool: 'inline-source-map', |
| 13 | + // entry: entries, |
| 14 | + entry: slsw.lib.entries, |
| 15 | + target: 'node', |
| 16 | + externals: [nodeExternals(), 'sharp'], |
| 17 | + module: { |
| 18 | + rules: [{ test: /\.ts(x?)$/, loader: 'ts-loader' }] |
| 19 | + }, |
| 20 | + resolve: { |
| 21 | + extensions: ['.ts', '.js', '.tsx', '.jsx'] |
| 22 | + }, |
| 23 | + // output: { |
| 24 | + // libraryTarget: 'commonjs', |
| 25 | + // path: path.join(__dirname, './../.dist'), |
| 26 | + // filename: 'handler.js', |
| 27 | + // devtoolModuleFilenameTemplate: '../../[resource-path]', |
| 28 | + // }, |
| 29 | + output: { |
| 30 | + libraryTarget: 'commonjs', |
| 31 | + path: path.join(__dirname, 'dist'), |
| 32 | + filename: '[name].js', |
| 33 | + sourceMapFilename: '[file].map', |
| 34 | + devtoolModuleFilenameTemplate: '[absolute-resource-path]' |
| 35 | + }, |
| 36 | + optimization: { minimize: false }, |
| 37 | + plugins: [], |
| 38 | + performance: { |
| 39 | + // Turn on size warnings for entry points |
| 40 | + hints: 'warning' |
| 41 | + } |
| 42 | +} |
0 commit comments