1 |
|
2 | const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
|
3 | const CompressionPlugin = require('compression-webpack-plugin');
|
4 |
|
5 |
|
6 | var webpack = require('webpack');
|
7 |
|
8 | var banner =
|
9 | '/*!\n' +
|
10 | ' * Copyright 2016 Amazon.com,\n' +
|
11 | ' * Inc. or its affiliates. All Rights Reserved.\n' +
|
12 | ' * \n' +
|
13 | ' * Licensed under the Amazon Software License (the "License").\n' +
|
14 | ' * You may not use this file except in compliance with the\n' +
|
15 | ' * License. A copy of the License is located at\n' +
|
16 | ' * \n' +
|
17 | ' * http://aws.amazon.com/asl/\n' +
|
18 | ' * \n' +
|
19 | ' * or in the "license" file accompanying this file. This file is\n' +
|
20 | ' * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR\n' +
|
21 | ' * CONDITIONS OF ANY KIND, express or implied. See the License\n' +
|
22 | ' * for the specific language governing permissions and\n' +
|
23 | ' * limitations under the License. \n' +
|
24 | ' */\n\n';
|
25 |
|
26 | var config = {
|
27 | entry: {
|
28 | 'amazon-cognito-identity': './src/index.js',
|
29 | 'amazon-cognito-identity.min': './src/index.js',
|
30 | },
|
31 | output: {
|
32 | filename: '[name].js',
|
33 | path: __dirname + '/dist',
|
34 | libraryTarget: 'umd',
|
35 | library: 'AmazonCognitoIdentity',
|
36 | devtoolModuleFilenameTemplate: require('../aws-amplify/webpack-utils')
|
37 | .devtoolModuleFilenameTemplate,
|
38 | },
|
39 | plugins: [
|
40 | new webpack.optimize.OccurrenceOrderPlugin(),
|
41 | new webpack.BannerPlugin({ banner, raw: true }),
|
42 | new UglifyJsPlugin({
|
43 | minimize: true,
|
44 | sourceMap: true,
|
45 | include: /\.min\.js$/,
|
46 | }),
|
47 | new CompressionPlugin({
|
48 | include: /\.min\.js$/,
|
49 | }),
|
50 | ],
|
51 | module: {
|
52 | rules: [
|
53 |
|
54 |
|
55 | {
|
56 | test: /\.js$/,
|
57 | exclude: /node_modules/,
|
58 | loader: 'babel-loader',
|
59 | query: {
|
60 | cacheDirectory: './node_modules/.cache/babel',
|
61 | },
|
62 | },
|
63 | ],
|
64 | },
|
65 | };
|
66 |
|
67 | module.exports = config;
|