-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
127 lines (124 loc) · 5.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
const Path = require('path');
const webpack = require('webpack');
const rootDir = Path.resolve();
const config = [
{
mode: 'development',
name: 'js',
entry: {
'DisplayLogicExtras': rootDir + '/client/src/DisplayLogicExtras.jsx'
},
output: {
path: rootDir,
filename: 'client/dist/[name].js',
devtoolModuleFilenameTemplate: '[resource-path]',
devtoolFallbackModuleFilenameTemplate: '[resource-path]'
},
devtool: 'nosources-source-map',
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: [
['@babel/env', { modules: false }],
'@babel/react',
],
comments: false,
},
},
},
],
},
externals: {
'apollo-client': 'ApolloClient',
'bootstrap-collapse': 'BootstrapCollapse',
classnames: 'classnames',
'deep-freeze-strict': 'DeepFreezeStrict',
'graphql-fragments': 'GraphQLFragments',
'graphql-tag': 'GraphQLTag',
history: 'history',
'isomorphic-fetch': 'IsomorphicFetch',
i18n: 'i18n',
jquery: 'jQuery',
merge: 'merge',
'page.js': 'Page',
'react-addons-test-utils': 'ReactAddonsTestUtils',
'react-dom': 'ReactDom',
poppers: 'Poppers',
reactstrap: 'Reactstrap',
'react-apollo': 'ReactApollo',
'react-redux': 'ReactRedux',
'react-router-redux': 'ReactRouterRedux',
'react-router': 'ReactRouter',
'react-select': 'ReactSelect',
'react-addons-css-transition-group': 'ReactAddonsCssTransitionGroup',
react: 'React',
'redux-form': 'ReduxForm',
'redux-thunk': 'ReduxThunk',
redux: 'Redux',
config: 'Config',
qs: 'qs',
moment: 'moment',
modernizr: 'modernizr',
'react-dnd': 'ReactDND',
'react-dnd-html5-backend': 'ReactDNDHtml5Backend',
validator: 'validator',
'prop-types': 'PropTypes',
// provided by silverstripe or modules
'components/Accordion/Accordion': 'Accordion',
'components/Accordion/AccordionBlock': 'AccordionBlock',
'components/Breadcrumb/Breadcrumb': 'Breadcrumb',
'components/FormAction/FormAction': 'FormAction',
'components/FormBuilder/FormBuilder': 'FormBuilder',
'components/FormBuilderModal/FormBuilderModal': 'FormBuilderModal',
'components/FieldHolder/FieldHolder': 'FieldHolder',
'components/GridField/GridField': 'GridField',
'components/Toolbar/Toolbar': 'Toolbar',
'components/LiteralField/LiteralField': 'LiteralField',
'components/Preview/Preview': 'Preview',
'components/ListGroup/ListGroup': 'ListGroup',
'components/ListGroup/ListGroupItem': 'ListGroupItem',
'components/Loading/Loading': 'Loading',
'components/FormAlert/FormAlert': 'FormAlert',
'components/Badge/Badge': 'Badge',
'components/TreeDropdownField/TreeDropdownField': 'TreeDropdownField',
'components/Focusedzone/Focusedzone': 'Focusedzone',
'components/ViewModeToggle/ViewModeToggle': 'ViewModeToggle',
'components/ResizeAware/ResizeAware': 'ResizeAware',
'components/Tag/Tag': 'Tag',
'components/Tag/TagList': 'TagList',
'components/Tag/CompactTagList': 'CompactTagList',
'components/Search/Search': 'Search',
'components/Search/SearchToggle': 'SearchToggle',
'containers/FormBuilderLoader/FormBuilderLoader': 'FormBuilderLoader',
'containers/InsertMediaModal/InsertMediaModal': 'InsertMediaModal',
'containers/InsertLinkModal/InsertLinkModal': 'InsertLinkModal',
'containers/InsertLinkModal/fileSchemaModalHandler': 'FileSchemaModalHandler',
'state/breadcrumbs/BreadcrumbsActions': 'BreadcrumbsActions',
'state/schema/SchemaActions': 'SchemaActions',
'state/records/RecordsActions': 'RecordsActions',
'state/records/RecordsActionTypes': 'RecordsActionTypes',
'state/viewMode/ViewModeActions': 'ViewModeActions',
'lib/DataFormat': 'DataFormat',
'lib/Backend': 'Backend',
'lib/getFormState': 'getFormState',
'lib/ReactRouteRegister': 'ReactRouteRegister',
'lib/ReducerRegister': 'ReducerRegister',
'lib/SilverStripeComponent': 'SilverStripeComponent',
'lib/formatWrittenNumber': 'formatWrittenNumber',
'lib/Router': 'Router',
'lib/schemaFieldValues': 'schemaFieldValues',
'lib/Config': 'Config',
'lib/Injector': 'Injector',
'lib/reduxFieldReducer': 'reduxFieldReducer',
'lib/TinyMCEActionRegistrar': 'TinyMCEActionRegistrar',
'lib/ShortcodeSerialiser': 'ShortcodeSerialiser',
}
},
];
// Use WEBPACK_CHILD=js or WEBPACK_CHILD=css env var to run a single config
module.exports = (process.env.WEBPACK_CHILD ? config.find((entry) => entry.name === process.env.WEBPACK_CHILD):module.exports = config);