Switch ts-loader to babel and add hmr
This commit is contained in:
parent
859ed6c331
commit
a621b0f6ab
4482
package-lock.json
generated
4482
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
@ -3,6 +3,7 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"start": "webpack serve --mode=development",
|
||||||
"build": "webpack --mode=development",
|
"build": "webpack --mode=development",
|
||||||
"dev": "webpack --mode=development --watch"
|
"dev": "webpack --mode=development --watch"
|
||||||
},
|
},
|
||||||
@ -10,6 +11,7 @@
|
|||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"description": "",
|
"description": "",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"fork-ts-checker-webpack-plugin": "^9.1.0",
|
||||||
"handlebars-loader": "^1.7.3",
|
"handlebars-loader": "^1.7.3",
|
||||||
"react": "^19.1.0",
|
"react": "^19.1.0",
|
||||||
"react-dom": "^19.1.0",
|
"react-dom": "^19.1.0",
|
||||||
@ -17,9 +19,15 @@
|
|||||||
"webpack-cli": "^6.0.1"
|
"webpack-cli": "^6.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@babel/core": "^7.26.10",
|
||||||
|
"@babel/preset-env": "^7.26.9",
|
||||||
|
"@babel/preset-react": "^7.26.3",
|
||||||
|
"@babel/preset-typescript": "^7.27.0",
|
||||||
"@eslint/js": "^9.25.1",
|
"@eslint/js": "^9.25.1",
|
||||||
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.16",
|
||||||
"@types/react": "^19.1.1",
|
"@types/react": "^19.1.1",
|
||||||
"@types/react-dom": "^19.1.2",
|
"@types/react-dom": "^19.1.2",
|
||||||
|
"babel-loader": "^10.0.0",
|
||||||
"copy-webpack-plugin": "^13.0.0",
|
"copy-webpack-plugin": "^13.0.0",
|
||||||
"css-loader": "^7.1.2",
|
"css-loader": "^7.1.2",
|
||||||
"eslint": "^9.25.1",
|
"eslint": "^9.25.1",
|
||||||
@ -29,9 +37,11 @@
|
|||||||
"globals": "^16.0.0",
|
"globals": "^16.0.0",
|
||||||
"html-webpack-plugin": "^5.6.3",
|
"html-webpack-plugin": "^5.6.3",
|
||||||
"prettier": "3.5.3",
|
"prettier": "3.5.3",
|
||||||
|
"react-refresh": "^0.17.0",
|
||||||
"style-loader": "^4.0.0",
|
"style-loader": "^4.0.0",
|
||||||
"ts-loader": "^9.5.2",
|
"ts-loader": "^9.5.2",
|
||||||
"typescript": "^5.8.2",
|
"typescript": "^5.8.2",
|
||||||
"typescript-eslint": "^8.31.0"
|
"typescript-eslint": "^8.31.0",
|
||||||
|
"webpack-dev-server": "^5.2.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
import React from 'react';
|
import React, { useState } from 'react';
|
||||||
import { arrowEl } from './arrow';
|
import { arrowEl } from './arrow';
|
||||||
import './style.css';
|
import './style.css';
|
||||||
|
|
||||||
const Banner = () => {
|
const Banner = () => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="container hero">
|
<div className="container hero">
|
||||||
<div className="hero-main">
|
<div className="hero-main">
|
||||||
<div className="hero-line"></div>
|
<div className="hero-line"></div>
|
||||||
<h1 className="hero-title">Discover And Create NFTs</h1>
|
<h1 className="hero-title">Discover And Create NFTs</h1>
|
||||||
<p className="hero-description">
|
<p className="hero-description">
|
||||||
Discover, Create and Sell NFTs On Our NFT Marketplace With Over
|
Discover, Create and Sell NFTs On Our NFT Marketplace With Over Thousands Of NFTs And Get
|
||||||
Thousands Of NFTs And Get a{' '}
|
a <span className="hero-description__bold">$20 bonus</span>.
|
||||||
<span className="hero-description__bold">$20 bonus</span>.
|
|
||||||
</p>
|
</p>
|
||||||
<div className="hero-buttons">
|
<div className="hero-buttons">
|
||||||
<button className="button">Explore More</button>
|
<button className="button">Explore More</button>
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
|
const webpack = require('webpack');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
|
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
|
||||||
|
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: './src/index.tsx',
|
entry: './src/index.tsx',
|
||||||
@ -8,15 +11,24 @@ module.exports = {
|
|||||||
path: path.resolve(__dirname, 'dist'),
|
path: path.resolve(__dirname, 'dist'),
|
||||||
clean: true,
|
clean: true,
|
||||||
},
|
},
|
||||||
|
devServer: {
|
||||||
|
hot: true,
|
||||||
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['.js', '.ts', '.jsx', '.tsx'],
|
extensions: ['.js', '.ts', '.jsx', '.tsx'],
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
{ test: /\.(ts|tsx)$/, loader: 'ts-loader' },
|
|
||||||
{
|
{
|
||||||
test: /\.hbs|html$/,
|
test: /\.(ts|tsx)$/,
|
||||||
loader: 'handlebars-loader'``,
|
exclude: /node_modules/,
|
||||||
|
use: {
|
||||||
|
loader: 'babel-loader',
|
||||||
|
options: {
|
||||||
|
plugins: [require.resolve('react-refresh/babel')],
|
||||||
|
presets: ['@babel/preset-env', '@babel/preset-react', '@babel/preset-typescript'],
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.css$/i,
|
test: /\.css$/i,
|
||||||
@ -29,5 +41,7 @@ module.exports = {
|
|||||||
template: './src/index.html',
|
template: './src/index.html',
|
||||||
filename: 'index.html',
|
filename: 'index.html',
|
||||||
}),
|
}),
|
||||||
|
new ReactRefreshWebpackPlugin(),
|
||||||
|
new ForkTsCheckerWebpackPlugin(),
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user