forked from fullcalendar/fullcalendar-workspace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
96 lines (84 loc) · 2.32 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
const path = require('path')
const webpack = require('webpack')
const { CheckerPlugin } = require('awesome-typescript-loader') // for https://github.com/webpack/webpack/issues/3460
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const packageConfig = require('./package.json')
/*
NOTE: js and typescript module names shouldn't have a .js extention,
however, all other types of modules should.
NOTE: ts entrypoints should be mirrored in tsconfig.json
*/
const MODULES = {
'dist/scheduler': './src/main.ts',
'dist/scheduler.css': './src/main.scss',
'tmp/automated-tests': './tests/automated/index.js'
}
const BANNER =
'<%= title %> v<%= version %>\n' +
'Docs & License: <%= homepage %>\n' +
'(c) <%= copyright %>'
module.exports = {
entry: MODULES,
externals: {
jquery: {
commonjs: 'jquery',
commonjs2: 'jquery',
amd: 'jquery',
root: 'jQuery'
},
moment: 'moment',
fullcalendar: {
commonjs: 'fullcalendar',
commonjs2: 'fullcalendar',
amd: 'fullcalendar',
root: 'FullCalendar'
}
},
resolve: {
extensions: ['.ts', '.js'],
alias: {
// use our slimmed down version
// still need to npm-install the original though, for typescript transpiler
'tslib': path.resolve(__dirname, 'src/tslib-lite.js'),
// when tests access core test libs, don't use NPM package, use checkout
'fullcalendar/tests': path.resolve(__dirname, 'fullcalendar/tests')
}
},
module: {
loaders: [
{
test: /\.(ts|js)$/,
loader: 'awesome-typescript-loader',
options: {
useCache: true
}
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract([ 'css-loader' ])
},
{
test: /\.(sass|scss)$/,
loader: ExtractTextPlugin.extract([ 'css-loader', 'sass-loader' ])
}
]
},
plugins: [
new CheckerPlugin(),
new ExtractTextPlugin({
filename: '[name]', // the module name should already have .css in it!
allChunks: true
}),
new webpack.BannerPlugin(BANNER)
],
watchOptions: {
aggregateTimeout: 100,
ignored: /node_modules/
},
output: {
libraryTarget: 'umd',
filename: '[name].js',
path: __dirname,
devtoolModuleFilenameTemplate: 'webpack:///' + packageConfig.name + '[resource-path]'
}
}