Files
pezkuwi-telemetry/frontend/webpack.config.js
T
James Wilson 779c5698a0 Update frontend build system to shed old dependencies, and address fallout from that (#521)
* get tests working and update copyright headers

* lint fix

* eslint ts update

* update CI to use NPM

* fix CI

* prettier

* npm, not yarn for docker

* remove unused package

* bump dockerfile to latest node LTS and no need for cache clean

* make frontend Dockerfile work and remove unused SUBSTRATE_TELEMETRY_SAMPLE

* remove final yarn references

* add another comment

* remove unused import

* remove more unused deps

* comment typo
2023-01-27 14:13:34 +00:00

51 lines
1.4 KiB
JavaScript

const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: './src/index.tsx',
devtool: 'inline-source-map',
module: {
rules: [
{
// Allow 'import * from "./foo.tsx"'
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
{
// allow 'import "foo.css"' and '@import "foo.css" in css files
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
generator: { filename: 'styles/[name].[contenthash][ext]' }
},
{
// allow 'import Icon from "./icon.png"'
test: /\.(png|svg|jpg|jpeg|gif)$/i,
type: 'asset/resource',
generator: { filename: 'images/[name].[contenthash][ext]' }
},
{
// allow CSS @url('./my-font.woff2')" style font loading
test: /\.(woff|woff2|eot|ttf|otf)$/i,
type: 'asset/resource',
generator: { filename: 'fonts/[name].[contenthash][ext]' }
},
],
},
plugins: [
// Use our index.html as a starting point (to add script links etc to)
// and make sure to use/copy over the favicon too.
new HtmlWebpackPlugin({
favicon: "./assets/favicon.svg",
template: "./assets/index.html"
}),
],
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
output: {
filename: 'main.[contenthash].js',
path: path.resolve(__dirname, 'build'),
clean: true
},
};