-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
webpack.config.js
53 lines (46 loc) · 1.8 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
// @ts-check
module.exports = function(env) {
const path = require('path');
const resources = require('@uifabric/build/webpack/webpack-resources');
const { addMonacoWebpackConfig } = require('@uifabric/tsx-editor/scripts/addMonacoWebpackConfig');
// @ts-ignore
const version = require('./package.json').version;
const isProductionArg = env && env.production;
const now = Date.now();
// Production defaults
let minFileNamePart = '';
const entryPointName = 'fabric-sitev5';
let publicPath = 'https://static2.sharepointonline.com/files/fabric/fabric-website/dist/';
// Dogfood overrides
if (!isProductionArg) {
publicPath = '/dist/';
} else {
minFileNamePart = '.min';
}
return resources.createConfig(
entryPointName,
isProductionArg,
addMonacoWebpackConfig({
entry: {
[entryPointName]: './lib/root.js'
},
output: {
publicPath: publicPath,
chunkFilename: `${entryPointName}-${version}-[name]-${now}${minFileNamePart}.js`
},
// The website config intentionally doesn't have React as an external because we bundle it
// to ensure we get a consistent version.
resolve: {
alias: {
'@uifabric/fabric-website/src': path.join(__dirname, 'src'),
'@uifabric/fabric-website/lib': path.join(__dirname, 'lib'),
'office-ui-fabric-react$': path.resolve(__dirname, '../../packages/office-ui-fabric-react/lib'),
'office-ui-fabric-react/src': path.resolve(__dirname, '../../packages/office-ui-fabric-react/src'),
'office-ui-fabric-react/lib': path.resolve(__dirname, '../../packages/office-ui-fabric-react/lib'),
'@uifabric/api-docs/lib': path.resolve(__dirname, '../../packages/api-docs/lib')
}
}
}),
/* only production */ isProductionArg
);
};