Skip to content
Snippets Groups Projects
Select Git revision
  • df0d4365de9e73612d1a6369da15fd0cd8fc099c
  • master default protected
  • v1.0.23
  • v1.0.19
  • v1.0.35
  • v1.0.18
  • v1.0.15
  • v1.0.12
  • v1.0.11
  • v.1.0.10
  • v1.0.9
  • v1.0.8
  • v1.0.7
  • v1.0.2
  • v1.0.1
15 results

webpack.js

Blame
  • user avatar
    Andrea Gottsponer authored
    df0d4365
    History
    webpack.js 2.38 KiB
    const path = require('path');
    const webpack = require('webpack');
    const HtmlWebpackPlugin = require('html-webpack-plugin');
    
    const outputDir = 'dist_example';
    const publicPath = '/';
    const tsConfig = 'tsconfig_example.json';
    
    module.exports = {
        entry: {
            index: [
                // "@babel/polyfill",
                "./src/app/index.ts"
            ]
        },
        output: {
            path: path.resolve(__dirname, outputDir),
            filename: '[name].bundle.js',
            publicPath: publicPath,
            crossOriginLoading: 'anonymous'
        },
        devtool: 'source-map',
        mode: 'development',
        module: {
            rules: [
                {
                    test: /\.js$/,
                    loader: 'babel-loader',
                    exclude: /node_modules/,
                },
                {
                    test: /\.tsx?$/,
                    use: [
                        {
                            loader: 'ts-loader',
                            options: {
                                configFile: tsConfig
                            }
                        }
                    ],
                    exclude: /node_modules/
                }
            ]
        },
        plugins: [
            new HtmlWebpackPlugin({
                title: 'Medsurf PIXI',
                template: 'src/public/index.html',
                hash: true,
                minify: {
                    collapseWhitespace: true,
                    removeComments: true,
                    removeRedundantAttributes: true,
                    removeScriptTypeAttributes: true,
                    removeStyleLinkTypeAttributes: true,
                    useShortDoctype: true
                }
            }),
            new webpack.ProvidePlugin({
                PIXI: 'pixi.js-legacy'
            }),
        ],
        node: {
            net: 'empty',
            tls: 'empty',
            dns: 'empty',
            fs: 'empty',
        },
        resolve: {
            extensions: ['.js', '.ts', '.tsx', '.css', '.scss', '.json'],
            modules: ['node_modules'],
            plugins: []
        },
        stats: 'verbose',
        devServer: {
            contentBase: path.join(__dirname, outputDir),
            compress: false,
            host: '0.0.0.0',
            port: 9000,
            publicPath: publicPath,
            https: false,
            overlay: {
                warnings: true,
                errors: true
            },
            historyApiFallback: true,
            headers: {
                "Access-Control-Allow-Origin": "*",
                "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
            }
        }
    };