isoflow/webpack/dev.config.js

54 lines
1.1 KiB
JavaScript
Raw Normal View History

const path = require('path');
const HtmlWebPackPlugin = require('html-webpack-plugin');
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
2023-03-24 23:32:36 +00:00
module.exports = {
mode: 'development',
entry: './src/index.tsx',
devtool: 'eval-cheap-source-map',
2023-03-24 23:32:36 +00:00
output: {
filename: 'main.js',
path: path.resolve(__dirname, 'build')
2023-03-24 23:32:36 +00:00
},
devServer: {
static: {
directory: path.join(__dirname, 'build')
2023-03-24 23:32:36 +00:00
},
allowedHosts: [
'.csb.app', // So Codesandbox.io can run the dev server
'.ngrok-free.app'
],
port: 3000
2023-03-24 23:32:36 +00:00
},
module: {
rules: [
{
test: /\.(ts|tsx)$/,
use: 'ts-loader',
exclude: /node_modules/
2023-03-24 23:32:36 +00:00
},
2023-07-12 11:16:52 +00:00
{
test: /\.css$/i,
use: ['style-loader', 'css-loader']
2023-07-12 11:16:52 +00:00
},
{
test: /\.svg$/,
use: [
{
loader: 'svg-url-loader'
}
]
}
]
2023-03-24 23:32:36 +00:00
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
plugins: [new TsconfigPathsPlugin()]
2023-03-24 23:32:36 +00:00
},
plugins: [
new HtmlWebPackPlugin({
template: path.resolve(__dirname, '../src/index.html')
})
]
2023-03-24 23:32:36 +00:00
};