forked from mattlewis92/angular-calendar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.umd.ts
More file actions
121 lines (119 loc) · 3.12 KB
/
webpack.config.umd.ts
File metadata and controls
121 lines (119 loc) · 3.12 KB
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
import * as fs from 'fs';
import * as path from 'path';
import * as webpack from 'webpack';
import * as ExtractTextPlugin from 'extract-text-webpack-plugin';
import * as autoprefixer from 'autoprefixer';
import * as postCssFlexibility from 'postcss-flexibility';
import * as StyleLintPlugin from 'stylelint-webpack-plugin';
import * as angularExternals from 'webpack-angular-externals';
import * as dateFnsExternals from 'webpack-date-fns-externals';
import * as rxjsExternals from 'webpack-rxjs-externals';
const pkg = JSON.parse(fs.readFileSync('./package.json').toString());
export default {
entry: path.join(__dirname, 'src/index.umd.ts'),
output: {
path: path.join(__dirname, 'dist/umd'),
filename: 'angular-calendar.js',
libraryTarget: 'umd',
library: 'angularCalendar'
},
externals: [
angularExternals(),
rxjsExternals(),
dateFnsExternals(), {
'calendar-utils': {
root: ['calendarUtils'],
commonjs: 'calendar-utils',
commonjs2: 'calendar-utils',
amd: 'calendar-utils'
},
'angular-resizable-element': {
root: 'angularResizableElement',
commonjs: 'angular-resizable-element',
commonjs2: 'angular-resizable-element',
amd: 'angular-resizable-element'
},
'angular-draggable-droppable': {
root: 'angularDraggableDroppable',
commonjs: 'angular-draggable-droppable',
commonjs2: 'angular-draggable-droppable',
amd: 'angular-draggable-droppable'
}
}],
module: {
rules: [{
enforce: 'pre',
test: /\.ts$/,
loader: 'tslint-loader',
exclude: /node_modules/,
options: {
emitErrors: true,
failOnHint: true
}
}, {
test: /\.ts$/,
loader: 'ts-loader',
exclude: /node_modules/,
options: {
compilerOptions: {
module: 'esnext'
}
}
}, {
test: /\.scss/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
'css-loader',
{
loader: 'postcss-loader',
options: {
plugins: [
autoprefixer({
browsers: [
'> 1%',
'last 4 versions',
'last 20 Chrome versions',
'last 20 Firefox versions'
]
}),
postCssFlexibility
]
}
},
'sass-loader'
]
}),
exclude: /node_modules/
}]
},
resolve: {
extensions: ['.ts', '.js']
},
plugins: [
new StyleLintPlugin({
syntax: 'scss',
context: 'scss',
failOnError: true
}),
new ExtractTextPlugin('./../css/angular-calendar.css'),
new webpack.SourceMapDevToolPlugin({
filename: 'angular-calendar.js.map',
test: /\.js($|\?)/i
}),
new webpack.BannerPlugin({
banner: `
/**
* ${pkg.name} - ${pkg.description}
* @version v${pkg.version}
* @author ${pkg.author}
* @link ${pkg.homepage}
* @license ${pkg.license}
*/
`.trim(),
raw: true,
entryOnly: true
}),
new webpack.optimize.ModuleConcatenationPlugin()
]
};