aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/config/webpack.video-embed.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/config/webpack.video-embed.js')
-rw-r--r--client/config/webpack.video-embed.js184
1 files changed, 0 insertions, 184 deletions
diff --git a/client/config/webpack.video-embed.js b/client/config/webpack.video-embed.js
deleted file mode 100644
index 2b70b6681..000000000
--- a/client/config/webpack.video-embed.js
+++ /dev/null
@@ -1,184 +0,0 @@
1const helpers = require('./helpers')
2
3const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin
4const HtmlWebpackPlugin = require('html-webpack-plugin')
5const UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin')
6const HashedModuleIdsPlugin = require('webpack/lib/HashedModuleIdsPlugin')
7const ExtractTextPlugin = require('extract-text-webpack-plugin')
8const PurifyCSSPlugin = require('purifycss-webpack')
9
10module.exports = function (options) {
11 const isProd = options && options.env === 'production'
12
13 const configuration = {
14 entry: {
15 'video-embed': './src/standalone/videos/embed.ts'
16 },
17
18 resolve: {
19 /*
20 * An array of extensions that should be used to resolve modules.
21 *
22 * See: http://webpack.github.io/docs/configuration.html#resolve-extensions
23 */
24 extensions: [ '.ts', '.js', '.json', '.scss' ],
25
26 modules: [ helpers.root('src'), helpers.root('node_modules') ]
27 },
28
29 output: {
30 path: helpers.root('dist/standalone/videos'),
31 filename: '[name].[hash].bundle.js',
32 sourceMapFilename: '[file].map',
33 chunkFilename: '[id].chunk.js',
34 publicPath: '/client/standalone/videos/'
35 },
36
37 module: {
38
39 rules: [
40 {
41 test: /\.ts$/,
42 use: [
43 {
44 loader: 'awesome-typescript-loader',
45 options: {
46 configFileName: 'tsconfig.webpack.json',
47 useCache: !isProd
48 }
49 }
50 ],
51 exclude: [/\.(spec|e2e)\.ts$/]
52 },
53
54 {
55 test: /\.(sass|scss)$/,
56 use: ExtractTextPlugin.extract({
57 fallback: 'style-loader',
58 use: [
59 {
60 loader: 'css-loader',
61 options: {
62 sourceMap: true,
63 importLoaders: 1
64 }
65 },
66 'resolve-url-loader',
67 {
68 loader: 'sass-loader',
69 options: {
70 sourceMap: true
71 }
72 },
73 {
74 loader: 'sass-resources-loader',
75 options: {
76 resources: [
77 helpers.root('src/sass/_variables.scss'),
78 helpers.root('src/sass/_mixins.scss')
79 ]
80 }
81 }
82 ]
83 })
84 },
85
86 {
87 test: /\.html$/,
88 use: 'raw-loader',
89 exclude: [
90 helpers.root('src/index.html'),
91 helpers.root('src/standalone/videos/embed.html')
92 ]
93 },
94
95 {
96 test: /\.(jpg|png|gif)$/,
97 use: 'url-loader'
98 },
99
100 { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, use: 'url-loader?limit=10000&minetype=application/font-woff' },
101 { test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, use: 'file-loader' }
102 ]
103
104 },
105
106 plugins: [
107 new ExtractTextPlugin({
108 filename: '[name].[contenthash].css'
109 }),
110
111 new PurifyCSSPlugin({
112 paths: [ helpers.root('src/standalone/videos/embed.ts') ],
113 purifyOptions: {
114 minify: true,
115 whitelist: [ '*vjs*', '*video-js*' ]
116 }
117 }),
118
119 new CheckerPlugin(),
120
121 new HtmlWebpackPlugin({
122 template: 'src/standalone/videos/embed.html',
123 filename: 'embed.html',
124 title: 'PeerTube',
125 chunksSortMode: 'dependency',
126 inject: 'body'
127 })
128 ],
129
130 node: {
131 global: true,
132 crypto: 'empty',
133 fs: 'empty',
134 process: true,
135 module: false,
136 clearImmediate: false,
137 setImmediate: false
138 }
139 }
140
141 if (isProd) {
142 configuration.module.rules.push(
143 {
144 test: /junk\/index\.js$/,
145 // exclude: /(node_modules|bower_components)/,
146 use: {
147 loader: 'babel-loader',
148 options: {
149 presets: [ 'env' ]
150 }
151 }
152 }
153 )
154
155 configuration.plugins.push(
156 new UglifyJsPlugin({
157 beautify: false,
158 output: {
159 comments: false
160 }, // prod
161 mangle: {
162 screw_ie8: true
163 }, // prod
164 compress: {
165 screw_ie8: true,
166 warnings: false,
167 conditionals: true,
168 unused: true,
169 comparisons: true,
170 sequences: true,
171 dead_code: true,
172 evaluate: true,
173 if_return: true,
174 join_vars: true,
175 negate_iife: false // we need this for lazy v8
176 }
177 }),
178
179 new HashedModuleIdsPlugin()
180 )
181 }
182
183 return configuration
184}