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 UglifyJsPlugin = require('uglifyjs-webpack-plugin')
7 const HashedModuleIdsPlugin = require('webpack/lib/HashedModuleIdsPlugin')
8 const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin')
9 const ExtractTextPlugin = require('extract-text-webpack-plugin')
10 const PurifyCSSPlugin = require('purifycss-webpack')
12 module.exports = function () {
13 const isProd = process.env.NODE_ENV === 'production'
15 const configuration = {
17 'video-embed': './src/standalone/videos/embed.ts'
22 * An array of extensions that should be used to resolve modules.
24 * See: http://webpack.github.io/docs/configuration.html#resolve-extensions
26 extensions: [ '.ts', '.js', '.json', '.scss' ],
28 modules: [ helpers.root('src'), helpers.root('node_modules') ],
31 'video.js$': path.resolve('node_modules/video.js/dist/alt/video.core.js')
36 path: helpers.root('dist/standalone/videos'),
37 filename: '[name].[hash].bundle.js',
38 sourceMapFilename: '[file].map',
39 chunkFilename: '[id].chunk.js',
40 publicPath: '/client/standalone/videos/'
43 // devtool: 'source-map',
52 loader: 'awesome-typescript-loader',
54 configFileName: 'tsconfig.json'
58 exclude: [/\.(spec|e2e)\.ts$/]
62 test: /\.(sass|scss)$/,
63 use: ExtractTextPlugin.extract({
64 fallback: 'style-loader',
75 loader: 'sass-loader',
79 helpers.root('src/sass/include')
91 helpers.root('src/index.html'),
92 helpers.root('src/standalone/videos/embed.html')
97 test: /\.(jpg|png|gif)$/,
101 { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, use: 'url-loader?limit=10000&minetype=application/font-woff' },
102 { test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, use: 'file-loader' }
108 new ExtractTextPlugin({
109 filename: '[name].[hash].css'
112 new PurifyCSSPlugin({
113 paths: [ helpers.root('src/standalone/videos/embed.ts') ],
116 whitelist: [ '*vjs*', '*video-js*' ]
122 new HtmlWebpackPlugin({
123 template: 'src/standalone/videos/embed.html',
124 filename: 'embed.html',
126 chunksSortMode: 'dependency',
131 * Plugin LoaderOptionsPlugin (experimental)
133 * See: https://gist.github.com/sokra/27b24881210b56bbaff7
135 new LoaderOptionsPlugin({
139 path: helpers.root('dist')
146 maxEntrypointSize: 700000, // 600kB
156 clearImmediate: false,
162 configuration.plugins.push(
180 new HashedModuleIdsPlugin()