-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.dev.config.js
100 lines (99 loc) · 3.34 KB
/
webpack.dev.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
94
95
96
97
98
99
100
// based on https://itnext.io/how-to-package-your-react-component-for-distribution-via-npm-d32d4bf71b4f
// and http://jasonwatmore.com/post/2018/04/14/react-npm-how-to-publish-a-react-component-to-npm
const path = require('path');
module.exports = {
devtool: 'source-map',
entry: {
Breadcrumb: './src/Breadcrumb/index.js',
FormModal: './src/FormModal/index.js',
ItemForm: './src/ItemForm/index.js',
List: './src/List/index.js',
SearchBar: './src/SearchBar/index.js',
PreviewCanvas: './src/PreviewCanvas/index.js',
VideoContextPreview: './src/PreviewCanvas/VideoContextPreview/index.js',
VideoContextProgressBar:
'./src/PreviewCanvas/VideoContextPreview/VideoContextProgressBar.js',
Controls: './src/PreviewCanvas/Controls.js',
Filler: './src/PreviewCanvas/Filler.js',
ProgressBar: './src/PreviewCanvas/ProgressBar.js',
ProgrammeScriptContainer: './src/ProgrammeScriptContainer/index.js',
ProgrammeElements:
'./src/ProgrammeScriptContainer/ProgrammeElements/index.js',
Note: './src/ProgrammeScriptContainer/ProgrammeElements/Note.js',
PaperCut: './src/ProgrammeScriptContainer/ProgrammeElements/PaperCut.js',
SortableHandle:
'./src/ProgrammeScriptContainer/ProgrammeElements/SortableHandle.js',
SortableItem:
'./src/ProgrammeScriptContainer/ProgrammeElements/SortableItem.js',
TitleHeading:
'./src/ProgrammeScriptContainer/ProgrammeElements/TitleHeading.js',
VoiceOver: './src/ProgrammeScriptContainer/ProgrammeElements/VoiceOver.js',
SimpleCard: './src/SimpleCard/index.js',
TranscriptCard: './src/TranscriptCard/index.js',
TranscriptForm: './src/TranscriptForm/index.js',
ProgressBar: './src/ProgressBar/index.js',
ProjectRow: './src/ProjectRow/index.js',
TranscriptRow: './src/TranscriptRow/index.js'
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js',
libraryTarget: 'commonjs2'
},
optimization: {
minimize: true
},
module: {
rules: [
{
test: /\.css$/,
use: [
{
loader: 'style-loader'
},
{
loader: 'css-loader',
options: {
modules: true
}
}
]
},
{
test: /\.(js|jsx)$/,
include: path.resolve(__dirname, 'src'),
// TODO: because it uses entry point to determine graph of dependencies, might not be needed to exclude test ans sample files?
exclude: /(node_modules|bower_components|build|dist|demo|\.storybook|storybook-static)$/,
use: {
loader: 'babel-loader',
options: {
presets: [ '@babel/preset-env', '@babel/preset-react' ]
}
}
}
]
},
resolve: {
alias: {
react: path.resolve(
'../digital-paper-edit-firebase/node_modules/react'
),
'react-dom': path.resolve(
'../digital-paper-edit-firebase/node_modules/react-dom'
),
'react-router': path.resolve(
'../digital-paper-edit-firebase/node_modules/react-router'
),
'react-router-dom': path.resolve(
'../digital-paper-edit-firebase/node_modules/react-router-dom'
)
},
symlinks: false
},
externals: {
react: 'react',
'react-dom': 'react-dom',
'react-router': 'react-router',
'react-router-dom': 'react-router-dom'
}
};