1 const helpers = require('./helpers')
2 const path = require('path')
4 const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin
5 const HtmlWebpackPlugin = require('html-webpack-plugin')
6 const TerserPlugin = require('terser-webpack-plugin')
7 const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin')
8 const ExtractTextPlugin = require('extract-text-webpack-plugin')
9 const PurifyCSSPlugin = require('purifycss-webpack')
11 module.exports = function () {
12 const configuration = {
14 'video-embed': './src/standalone/videos/embed.ts',
15 'player': './src/standalone/player/player.ts',
16 'test-embed': './src/standalone/videos/test-embed.ts'
21 * An array of extensions that should be used to resolve modules.
23 * See: http://webpack.github.io/docs/configuration.html#resolve-extensions
25 extensions: [ '.ts', '.js', '.json', '.scss' ],
27 modules: [ helpers.root('src'), helpers.root('node_modules') ],
30 'video.js$': path.resolve('node_modules/video.js/core.js')
35 path: helpers.root('dist/standalone/videos'),
36 filename: '[name].[hash].bundle.js',
37 sourceMapFilename: '[file].map',
38 chunkFilename: '[id].chunk.js',
39 publicPath: '/client/standalone/videos/'
42 devtool: process.env.NODE_ENV === 'production' ? false : 'source-map',
51 loader: 'awesome-typescript-loader',
53 configFileName: 'tsconfig.json'
57 exclude: [/\.(spec|e2e)\.ts$/]
61 test: /\.(sass|scss)$/,
62 use: ExtractTextPlugin.extract({
63 fallback: 'style-loader',
73 // loader: 'resolve-url-loader',
79 loader: 'sass-loader',
84 helpers.root('src/sass/include')
97 helpers.root('src/index.html'),
98 helpers.root('src/standalone/videos/embed.html'),
99 helpers.root('src/standalone/videos/test-embed.html')
104 test: /\.(jpg|png|gif)$/,
108 { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, use: 'url-loader?limit=10000&minetype=application/font-woff' },
109 { test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, use: 'file-loader' }
115 new ExtractTextPlugin({
116 filename: '[name].[hash].css'
119 new PurifyCSSPlugin({
121 helpers.root('src/standalone/videos/embed.ts'),
122 helpers.root('src/standalone/videos/test-embed.html')
126 whitelist: [ '*vjs*', '*video-js*' ]
132 new HtmlWebpackPlugin({
133 template: 'src/standalone/videos/embed.html',
134 filename: 'embed.html',
136 chunksSortMode: 'auto',
138 chunks: ['video-embed']
141 new HtmlWebpackPlugin({
142 template: '!!html-loader!src/standalone/videos/test-embed.html',
143 filename: 'test-embed.html',
145 chunksSortMode: 'auto',
147 chunks: ['test-embed']
151 * Plugin LoaderOptionsPlugin (experimental)
153 * See: https://gist.github.com/sokra/27b24881210b56bbaff7
155 new LoaderOptionsPlugin({
159 path: helpers.root('dist')
187 maxEntrypointSize: 700000, // 600kB
197 clearImmediate: false,