const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
// const CleanWebpackPlugin = require('clean-webpack-plugin');
const previewHtmlWebpackPlugin = new HtmlWebpackPlugin({
    title: 'cocos creator 3d preview',
    template: 'preview.html'
});
module.exports = {
    entry: './src/index.ts',
    devtool: 'inline-source-map',
    devServer: {
        contentBase: './dist',
        proxy: {
            '/res/': 'http://localhost:7456'
        }
    },
    plugins:[
        previewHtmlWebpackPlugin
        // new CleanWebpackPlugin(['dist']),
    ],
    externals: {
        cc: "cc"
    },
    module: {
        rules: [
            {
                test: /\.tsx?$/,
                use: 'ts-loader',
                exclude: /node_modules/
            }
        ]
    },
    resolve: {
        extensions: ['.tsx', '.ts', '.js']
    },
    output: {
        filename: 'bundle.js',
        path: path.resolve(__dirname, 'dist')
    }
};