53 lines
1.4 KiB
JavaScript
53 lines
1.4 KiB
JavaScript
const path = require('path');
|
|
const HtmlPlugin = require('html-webpack-plugin');
|
|
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
|
const CopyPlugin = require('copy-webpack-plugin');
|
|
|
|
module.exports = {
|
|
entry: {
|
|
main: './src/index.tsx',
|
|
},
|
|
resolve: {
|
|
extensions: ['.ts', '.tsx', '.js', '.jsx', '.css', '.scss'],
|
|
},
|
|
devServer: {
|
|
historyApiFallback: true,
|
|
host: '0.0.0.0',
|
|
hot: true,
|
|
port: 3000,
|
|
},
|
|
output: {
|
|
path: path.join(__dirname, '/dist'),
|
|
filename: `bundle.js?t=${new Date().getTime()}`,
|
|
publicPath: '/',
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.tsx?$/,
|
|
loader: 'awesome-typescript-loader',
|
|
},
|
|
{
|
|
test: /\.css$/,
|
|
loader: ExtractTextPlugin.extract('css-loader'),
|
|
},
|
|
{
|
|
test: /\.(sass|scss)$/,
|
|
loader: ExtractTextPlugin.extract({
|
|
fallback: 'style-loader',
|
|
use: 'css-loader!sass-loader',
|
|
}),
|
|
},
|
|
],
|
|
},
|
|
plugins: [
|
|
new ExtractTextPlugin(`bundle.css?t=${new Date().getTime()}`),
|
|
new HtmlPlugin({
|
|
template: './index.html',
|
|
}),
|
|
new CopyPlugin([{ from: 'config.js' }]),
|
|
],
|
|
watchOptions: {
|
|
ignored: /node_modules/,
|
|
},
|
|
}; |