-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
47 lines (42 loc) · 1.1 KB
/
webpack.config.js
File metadata and controls
47 lines (42 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const AwsSamPlugin = require("aws-sam-webpack-plugin");
const awsSamPlugin = new AwsSamPlugin();
const path = require('path');
const MiniCssExtractPlugin = require("mini-css-extract-plugin")
module.exports = {
entry: () => awsSamPlugin.entry(),
output: {
path: path.resolve("."),
filename: (chunkData) => awsSamPlugin.filename(chunkData),
libraryTarget: 'commonjs'
},
target: 'node',
mode: 'production',
// Add the AWS SAM Webpack plugin
plugins: [
awsSamPlugin,
new MiniCssExtractPlugin({
filename: '/.aws-sam/build/[name]/styles.css',
})
],
module: {
rules: [
{ test: /\.js$/, exclude: /node_modules/, loader: "babel-loader" },
{
test: /\.[s]?css$/,
include: [
path.join(__dirname, "/hello-world/src"),
path.join(__dirname, "node_modules")
],
use: [
MiniCssExtractPlugin.loader,
{ loader: "css-loader" },
{ loader: "sass-loader" }
]
}
]
}
}
/*
example
https://hackernoon.com/deploying-a-node-js-twitter-bot-on-aws-lambda-using-webpack-df6e2e187a78
*/