2019-05-05 02:44:01 +02:00
|
|
|
const path = require('path');
|
2019-05-08 00:01:54 +02:00
|
|
|
const CleanWebpackPlugin = require('clean-webpack-plugin');
|
2019-05-05 02:44:01 +02:00
|
|
|
|
|
|
|
module.exports = {
|
2019-05-08 00:01:54 +02:00
|
|
|
entry: {
|
|
|
|
uhr: './src/index.ts',
|
|
|
|
style_main: require.resolve('./resources/styles/uhr.scss'),
|
|
|
|
style_black: require.resolve('./css/uhr-black.css'),
|
|
|
|
style_blue: require.resolve('./css/uhr-blue.css'),
|
|
|
|
style_green: require.resolve('./css/uhr-green.css'),
|
|
|
|
style_pink: require.resolve('./css/uhr-pink.css'),
|
|
|
|
style_red: require.resolve('./css/uhr-red.css'),
|
|
|
|
style_white: require.resolve('./css/uhr-white.css'),
|
|
|
|
style_yellow: require.resolve('./css/uhr-yellow.css')
|
|
|
|
|
|
|
|
},
|
2019-05-06 02:03:44 +02:00
|
|
|
// devtool: 'inline-source-map',
|
|
|
|
mode: 'production',
|
2019-05-05 02:44:01 +02:00
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
2019-05-05 12:18:46 +02:00
|
|
|
enforce: 'pre',
|
2019-05-05 02:44:01 +02:00
|
|
|
test: /\.tsx?$/,
|
2019-05-05 12:18:46 +02:00
|
|
|
exclude: /node_modules/,
|
|
|
|
use: 'eslint-loader'
|
2019-05-08 00:01:54 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(png|svg|jpg|gif|woff)$/,
|
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: 'file-loader',
|
|
|
|
options: {
|
|
|
|
name: 'assets/[name].[ext]'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
|
|
|
|
//////
|
|
|
|
|
|
|
|
{
|
|
|
|
test: /\.s?css$/,
|
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: 'file-loader',
|
|
|
|
options: {
|
|
|
|
name: 'assets/[name].css'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
loader: 'extract-loader',
|
|
|
|
options: {
|
|
|
|
publicPath: '../',
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'css-loader',
|
|
|
|
{
|
|
|
|
loader: 'sass-loader',
|
|
|
|
options: {
|
|
|
|
outputStyle: 'compressed'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
// {
|
|
|
|
// test: /\.s?css$/,
|
|
|
|
// use: [
|
|
|
|
// // fallback to style-loader in development
|
|
|
|
// process.env.NODE_ENV !== 'production' ? 'style-loader' : MiniCssExtractPlugin.loader,
|
|
|
|
// 'css-loader',
|
|
|
|
// 'sass-loader'
|
|
|
|
// ]
|
|
|
|
// },
|
|
|
|
{
|
2019-05-05 12:18:46 +02:00
|
|
|
test: /\.tsx?$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
use: 'ts-loader'
|
2019-05-05 02:44:01 +02:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2019-05-08 00:01:54 +02:00
|
|
|
plugins: [
|
|
|
|
new CleanWebpackPlugin({
|
|
|
|
dry: false,
|
|
|
|
cleanAfterEveryBuildPatterns: ['**/deleteme_*.del'],
|
|
|
|
dangerouslyAllowCleanPatternsOutsideProject: false
|
|
|
|
})
|
|
|
|
],
|
2019-05-05 02:44:01 +02:00
|
|
|
resolve: {
|
|
|
|
extensions: ['.tsx', '.ts', '.js']
|
|
|
|
},
|
|
|
|
output: {
|
2019-05-08 00:01:54 +02:00
|
|
|
filename: (chunkData) => chunkData.chunk.name === 'uhr' ? 'uhr.js' : 'deleteme_[name].del',
|
2019-05-06 02:03:44 +02:00
|
|
|
library: 'uhr',
|
2019-05-05 02:44:01 +02:00
|
|
|
path: path.resolve(__dirname, 'dist')
|
2019-05-06 02:03:44 +02:00
|
|
|
},
|
|
|
|
externals: {
|
|
|
|
jquery: 'jQuery',
|
|
|
|
'js-cookie': 'Cookies'
|
2019-05-05 02:44:01 +02:00
|
|
|
}
|
|
|
|
};
|