stremio-web/webpack.config.js

83 lines
2.3 KiB
JavaScript
Raw Normal View History

2018-06-04 12:56:17 +00:00
const path = require('path');
const HtmlWebPackPlugin = require('html-webpack-plugin');
2018-06-11 13:16:07 +00:00
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
2018-06-04 12:56:17 +00:00
module.exports = {
entry: './src/index.js',
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: '/'
2018-06-04 12:56:17 +00:00
},
module: {
rules: [
{
test: /\.js$/,
2018-06-11 12:58:34 +00:00
include: [
path.resolve(__dirname, 'src'),
path.resolve(__dirname, 'node_modules/stremio-icons/dom')
],
2018-06-04 12:56:17 +00:00
use: {
loader: 'babel-loader'
}
2018-06-04 14:38:28 +00:00
},
{
2018-06-05 08:49:35 +00:00
test: /\.less$/,
2018-06-04 14:38:28 +00:00
exclude: /node_modules/,
use: [
{
loader: 'style-loader'
},
{
loader: 'css-loader',
options: {
modules: true,
localIdentName: '[hash:base64:5]'
}
2018-06-05 08:49:35 +00:00
},
{
loader: 'less-loader',
options: {
strictMath: true,
2018-06-05 09:14:27 +00:00
noIeCompat: true,
compress: true,
paths: [
path.resolve(__dirname, 'node_modules/stremio-colors')
]
2018-06-05 08:49:35 +00:00
}
2018-06-04 14:38:28 +00:00
}
]
2018-06-04 12:56:17 +00:00
}
]
},
2018-06-04 13:34:15 +00:00
resolve: {
2018-06-12 08:11:42 +00:00
extensions: ['.js', '.json', '.less'],
2018-06-04 13:34:15 +00:00
alias: {
'stremio-common': path.resolve(__dirname, 'src/common')
}
},
devServer: {
historyApiFallback: true
},
2018-06-04 12:56:17 +00:00
plugins: [
new HtmlWebPackPlugin({
template: './src/index.html'
}),
new UglifyJsPlugin({
test: /\.js$/,
uglifyOptions: {
mangle: true,
output: {
ecma: 5,
comments: false,
beautify: false,
wrap_iife: true
}
}
}),
new CopyWebpackPlugin([
{ from: 'images' }
])
2018-06-04 12:56:17 +00:00
]
};