-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
93 lines (89 loc) · 2.49 KB
/
webpack.config.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
'use strict';
import webpack from 'webpack';
import path from 'path';
import { PRODUCTION } from './config';
import paths from './paths';
const entryPoints = {
bundle: path.resolve(__dirname, paths.src.scripts),
};
export const config = {
entry: Object.keys(entryPoints).reduce((acc, currentKey) => {
acc[currentKey] = [entryPoints[currentKey]];
return acc;
}, {}),
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, paths.build.scripts),
publicPath: '/assets/js',
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
enforce: 'pre',
include: [
path.resolve(__dirname, 'src/assets/js'),
path.resolve(__dirname, 'src/assets/components'),
path.resolve(__dirname, 'node_modules/gsap'),
path.resolve(__dirname, 'node_modules/swiper'),
],
use: [
'babel-loader',
{
options: {
eslintPath: require.resolve('eslint'),
cache: true,
configFile: path.resolve('.eslintrc'),
},
loader: require.resolve('eslint-loader'),
},
],
},
],
},
resolve: {
extensions: ['.js', '.jsx'],
modules: ['node_modules'],
alias: {
react: 'preact-compat',
'react-dom': 'preact-compat',
'create-react-class': 'preact-compat/lib/create-react-class',
'react-dom-factories': 'preact-compat/lib/react-dom-factories',
ScrollMagic: path.resolve(
'node_modules',
'scrollmagic/scrollmagic/uncompressed/ScrollMagic.js'
),
'animation.gsap': path.resolve(
'node_modules',
'scrollmagic/scrollmagic/uncompressed/plugins/animation.gsap.js'
),
'debug.addIndicators': path.resolve(
'node_modules',
'scrollmagic/scrollmagic/uncompressed/plugins/debug.addIndicators.js'
),
TweenLite: path.resolve(
'node_modules',
'gsap/src/uncompressed/TweenLite.js'
),
TweenMax: path.resolve(
'node_modules',
'gsap/src/uncompressed/TweenMax.js'
),
TimelineLite: path.resolve(
'node_modules',
'gsap/src/uncompressed/TimelineLite.js'
),
TimelineMax: path.resolve(
'node_modules',
'gsap/src/uncompressed/TimelineMax.js'
),
},
},
devtool: PRODUCTION ? undefined : 'eval',
mode: PRODUCTION ? 'production' : 'development',
optimization: {
minimize: PRODUCTION,
},
watch: !PRODUCTION,
};
export default config;