Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const webpack = require('webpack');
- const path = require('path');
- const CleanTerminalPlugin = require('clean-terminal-webpack-plugin');
- let startTime = null;
- const plugins = [
- new CleanTerminalPlugin({
- message: "Compiling..."
- }),
- {
- apply: compiler => {
- compiler.hooks.beforeCompile.tap('BeforeCompilePlugin', compilation => {
- startTime = new Date();
- });
- }
- },
- {
- apply: (compiler) => {
- compiler.hooks.done.tap('DonePlugin', (compilation) => {
- let date = new Date();
- let months = [
- 'Jan', 'Feb', 'Mar',
- 'Apr', 'May', 'Jun',
- 'Jul', 'Aug', 'Sep',
- 'Oct', 'Nov', 'Dec'
- ];
- let minutes = date.getMinutes() < 10 ? ("0" + date.getMinutes()) : ("" + date.getMinutes());
- let timeString = `${date.getDate()} ${months[date.getMonth() - 1]} ${date.getFullYear()} - ${date.getHours()}:${minutes}`;
- console.log(`Complete [${date - startTime}ms]`);
- console.log(`[${timeString}]`);
- });
- }
- }
- ];
- module.exports = {
- mode: "production", //process.env.MODE,
- entry: {
- index: path.resolve(__dirname, 'src/main.tsx')
- },
- module: {
- rules: [
- {
- test: /\.tsx?$/,
- use: [
- {
- loader: 'ts-loader',
- options: {
- transpileOnly: true,
- experimentalWatchApi: true,
- },
- }
- ],
- //include: path.resolve(__dirname, "src")
- },
- /*{ test: /\.css$/i, use: [ 'style-loader', 'css-loader' ] },
- { test: /\.(png|woff|woff2|eot|ttf|svg)$/, loader: 'url-loader?limit=100000' }*/
- ],
- },
- optimization: {
- removeAvailableModules: false,
- removeEmptyChunks: false,
- minimize: false,
- splitChunks: false
- },
- resolve: {
- extensions: ['.tsx', '.ts', '.js']
- },
- plugins: plugins,
- output: {
- //filename: (process.env.MODE == "development") ? '[name].js' : '[name].[chunkhash].js',
- filename: "[name].js",
- pathinfo: false,
- path: path.resolve(__dirname, '../server/public'),
- publicPath: '/'
- },
- //watch: process.env.MODE == "development",
- stats: "minimal"
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement