-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebpack.common.js
101 lines (99 loc) · 2.56 KB
/
webpack.common.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/* eslint-disable import/no-extraneous-dependencies */
const webpack = require('webpack');
const FaviconsWebpackPlugin = require('favicons-webpack-plugin');
const HtmlWebPackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const path = require('path');
module.exports = {
output: {
filename: 'app.js',
publicPath: '/',
},
resolve: {
alias: {
'@': path.join(__dirname, 'src'),
},
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
},
},
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader'],
},
{
test: /\.(png|svg|jpg|gif)$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
},
},
],
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
},
},
],
},
{
test: /\.m?js/,
resolve: {
fullySpecified: false,
},
},
],
},
plugins: [
new webpack.DefinePlugin({
SENTRY_DSN: JSON.stringify(process.env.FRONTEND_SENTRY_DSN),
PXT_HEX_URL: JSON.stringify(process.env.PXT_HEX_URL
|| 'https://rovercode-pxt.s3.us-east-2.amazonaws.com/alpha/rovercode.hex'),
SAVE_DEBOUNCE_TIME: JSON.stringify(process.env.SAVE_DEBOUNCE_TIME),
SEARCH_DEBOUNCE_TIME: JSON.stringify(process.env.SEARCH_DEBOUNCE_TIME),
SUBSCRIPTION_SERVICE: JSON.stringify(process.env.SUBSCRIPTION_SERVICE
|| 'http://localhost:3000'),
STRIPE_SHARABLE_KEY: JSON.stringify(process.env.STRIPE_SHARABLE_KEY
|| 'pk_test_51HFVMDDAGjnnjW0cTIvpN2q1eigGLhpgdu3hI5qwWqfd5LPgDpuvyTCFOIiyV1ink662rRNAIPkvjD1FAf5SJFY400rlIgsZ4P'),
}),
new HtmlWebPackPlugin({
template: './src/index.html',
filename: './index.html',
title: 'Rovercode',
}),
new MiniCssExtractPlugin({
filename: 'app.css',
}),
new FaviconsWebpackPlugin({
logo: './src/assets/images/favicon.png',
cache: true,
inject: true,
favicons: {
icons: {
android: false,
appleIcon: false,
appleStartup: false,
coast: false,
favicons: true,
firefox: false,
windows: false,
yandex: false,
},
},
}),
],
devtool: 'source-map',
};