* Webpack Plugins
*/
-var CopyWebpackPlugin = (CopyWebpackPlugin = require('copy-webpack-plugin'), CopyWebpackPlugin.default || CopyWebpackPlugin)
+const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin
+const WebpackNotifierPlugin = require('webpack-notifier')
/*
* Webpack Constants
*/
const METADATA = {
title: 'PeerTube',
- baseUrl: '/'
+ baseUrl: '/',
+ isDevServer: helpers.isWebpackDevServer()
}
/*
// remove other default values
modulesDirectories: [ 'node_modules' ]
-
},
output: {
*/
preLoaders: [
- /*
- * Tslint loader support for *.ts files
- *
- * See: https://github.com/wbuchwalter/tslint-loader
- */
- // { test: /\.ts$/, loader: 'tslint-loader', exclude: [ helpers.root('node_modules') ] },
-
- /*
- * Source map loader support for *.js files
- * Extracts SourceMaps for source files that as added as sourceMappingURL comment.
- *
- * See: https://github.com/webpack/source-map-loader
- */
{
- test: /\.js$/,
- loader: 'source-map-loader',
- exclude: [
- // these packages have problems with their sourcemaps
- helpers.root('node_modules/rxjs'),
- helpers.root('node_modules/@angular')
- ]
+ test: /\.ts$/,
+ loader: 'string-replace-loader',
+ query: {
+ search: '(System|SystemJS)(.*[\\n\\r]\\s*\\.|\\.)import\\((.+)\\)',
+ replace: '$1.import($3).then(mod => mod.__esModule ? mod.default : mod)',
+ flags: 'g'
+ },
+ include: [helpers.root('src')]
}
],
*/
{
test: /\.ts$/,
- loader: 'awesome-typescript-loader',
+ loaders: [
+ 'awesome-typescript-loader',
+ 'angular2-template-loader',
+ '@angularclass/hmr-loader'
+ ],
exclude: [/\.(spec|e2e)\.ts$/]
},
loader: 'json-loader'
},
- /*
- * Raw loader support for *.css files
- * Returns file content as string
- *
- * See: https://github.com/webpack/raw-loader
- */
{
test: /\.scss$/,
exclude: /node_modules/,
},
+ sassLoader: {
+ precision: 10
+ },
+
/*
* Add additional plugins to the compiler.
*
*/
new ForkCheckerPlugin(),
- /*
- * Plugin: OccurenceOrderPlugin
- * Description: Varies the distribution of the ids to get the smallest id length
- * for often used ids.
- *
- * See: https://webpack.github.io/docs/list-of-plugins.html#occurrenceorderplugin
- * See: https://github.com/webpack/docs/wiki/optimization#minimize
- */
- new webpack.optimize.OccurenceOrderPlugin(true),
-
/*
* Plugin: CommonsChunkPlugin
* Description: Shares common code between the pages.
*
* See: https://www.npmjs.com/package/copy-webpack-plugin
*/
- new CopyWebpackPlugin([{
- from: 'src/assets',
- to: 'assets'
- }]),
+ new CopyWebpackPlugin([
+ {
+ from: 'src/assets',
+ to: 'assets'
+ },
+ {
+ from: 'node_modules/webtorrent/webtorrent.min.js',
+ to: 'assets/webtorrent'
+ }
+ ]),
/*
* Plugin: HtmlWebpackPlugin
chunksSortMode: 'dependency'
}),
- new webpack.ProvidePlugin({
- jQuery: 'jquery',
- $: 'jquery',
- jquery: 'jquery'
- })
-
+ new WebpackNotifierPlugin({ alwaysNotify: true })
],
/*
node: {
global: 'window',
crypto: 'empty',
+ fs: 'empty',
+ events: true,
module: false,
clearImmediate: false,
setImmediate: false