-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathwebpack.config.base.js
80 lines (77 loc) · 1.9 KB
/
webpack.config.base.js
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
const path = require('path');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
const webpack = require('webpack');
const env = require('node-env-file');
const outputFolder = 'build';
const emoji = require('./src/constants/emoji');
env(__dirname + '/.env');
module.exports = {
context: __dirname,
output: {
path: path.resolve(__dirname, outputFolder),
filename: '[name]_[chunkhash].bundle.js',
clean: true
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
{
test: /\.(eot|svg|ttf|woff|woff2)$/,
loader: 'file-loader',
options: {
'name': '[name].[ext]'
}
},
{
test: /\.wav$/,
loader: 'file-loader',
options: {
'name': '[name].[ext]'
}
}
]
},
resolve: {
extensions: ['.js', '.jsx', '.css', '.scss', '.json'],
modules: [
'node_modules'
],
fallback: {
"crypto": require.resolve('crypto-browserify'),
"stream": require.resolve("stream-browserify"),
buffer: require.resolve("buffer/"),
}
},
plugins: [
new HtmlWebpackPlugin({
title: 'LeapChat',
template: './src/index-template.ejs'
}),
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
}),
new MiniCssExtractPlugin({
filename: '[name].css',
}),
new CopyPlugin([
{
from: 'node_modules/emoji-datasource-apple/img/apple/64',
to: emoji.EMOJI_APPLE_64_PATH
},
{
from: 'node_modules/emoji-datasource-apple/img/apple/sheets/64.png',
to: emoji.EMOJI_APPLE_64_SHEET
},
{
from: 'src/static/js/emoji-fixed.js',
to: '../node_modules/emoji-js/lib/emoji.js'
}
]),
]
}