-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.common.js
More file actions
57 lines (55 loc) · 1.89 KB
/
webpack.common.js
File metadata and controls
57 lines (55 loc) · 1.89 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
48
49
50
51
52
53
54
55
56
57
const path = require('path');
const AwsSamPlugin = require('aws-sam-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
const sass = require('sass');
const awsSamPlugin = new AwsSamPlugin({ vscodeDebug: false });
const LAMBDA_NAME = 'AtfAvailabilityFunction';
module.exports = {
entry: () => awsSamPlugin.entry(),
output: {
filename: (chunkData) => awsSamPlugin.filename(chunkData),
libraryTarget: 'commonjs2',
path: path.resolve('.')
},
resolve: {
extensions: ['.ts', '.js']
},
target: 'node',
node: {
__dirname: false,
__filename: false,
},
externals: [{ fsevents: "require('fsevents')" }],
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'ts-loader'
},
]
},
plugins: [
awsSamPlugin,
new CopyPlugin({
patterns: [
{ from: './simple-proxy-api.yml', to: '.aws-sam/build/simple-proxy-api.yml' },
{ from: './src/views', to: `.aws-sam/build/${LAMBDA_NAME}/views` },
{ from: './node_modules/govuk-frontend', to: `.aws-sam/build/${LAMBDA_NAME}/views/govuk-frontend` },
{ from: './node_modules/govuk-frontend/dist/govuk/assets/', to: `.aws-sam/build/${LAMBDA_NAME}/public/assets` },
{ from: './node_modules/govuk-frontend/dist/govuk/assets/rebrand/images', to: `.aws-sam/build/${LAMBDA_NAME}/public/assets/images` },
{ from: './node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js', to: `.aws-sam/build/${LAMBDA_NAME}/public/all.js` },
{
from: './src/public/scss/index.scss',
to: `.aws-sam/build/${LAMBDA_NAME}/public/all.css`,
transform: (content, path) => {
const result = sass.compileString(content.toString(), {
loadPaths: ['./src/public/scss/'],
style: 'compressed',
});
return result.css.toString();
}
},
],
}),
],
};