React + Webpack added
This commit is contained in:
parent
3f5c875cf1
commit
d280c1b2fa
File diff suppressed because it is too large
Load Diff
18
package.json
18
package.json
|
@ -22,14 +22,26 @@
|
|||
"author": "Abdussamed ULUTAŞ <abdussamedulutas@yandex.com.tr>",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
||||
"@babel/plugin-transform-runtime": "^7.23.9",
|
||||
"@babel/preset-env": "^7.23.9",
|
||||
"@babel/preset-react": "^7.23.3",
|
||||
"@reduxjs/toolkit": "^2.1.0",
|
||||
"babel-loader": "^9.1.3",
|
||||
"css-loader": "^6.9.1",
|
||||
"express": "^4.18.2",
|
||||
"file-loader": "^6.2.0",
|
||||
"knex": "^3.1.0",
|
||||
"mini-css-extract-plugin": "^2.7.7",
|
||||
"mysql": "^2.18.1",
|
||||
"parcel": "^2.11.0",
|
||||
"parcel-cli": "^1.1.0",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-redux": "^9.1.0",
|
||||
"sass": "^1.70.0"
|
||||
"react-router-dom": "^6.21.3",
|
||||
"sass": "^1.70.0",
|
||||
"sass-loader": "^14.0.0",
|
||||
"style-loader": "^3.3.4",
|
||||
"ts-loader": "^9.5.1",
|
||||
"typescript": "^5.3.3"
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,29 @@
|
|||
/**
|
||||
* @license React
|
||||
* react-dom.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* react.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* scheduler.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
|
@ -1,11 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html lang="tr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<title>Assemble</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Hello !</h2>
|
||||
<script src="./assets/bundle.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -2,7 +2,6 @@ const express = require("express");
|
|||
const {resolve} = require("node:path");
|
||||
const {app} = require("./http");
|
||||
|
||||
|
||||
app.use(
|
||||
express.static(
|
||||
resolve(__dirname,"../public"),
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
import React from "react";
|
||||
import {createRoot} from "react-dom/client";
|
||||
|
||||
const rootDom = document.createElement("div");
|
||||
document.body.appendChild(rootDom);
|
||||
|
||||
const root = createRoot(rootDom);
|
||||
|
||||
root.render(<h1>
|
||||
Merhaba
|
||||
</h1>);
|
|
@ -0,0 +1,120 @@
|
|||
const {resolve} = require('path');
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||
//const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
||||
|
||||
const isProduction = process.argv[process.argv.indexOf('--mode') + 1] === 'production';
|
||||
|
||||
module.exports = {
|
||||
entry:[
|
||||
resolve(__dirname,"ui/index.js")
|
||||
],
|
||||
output:{
|
||||
path: resolve(__dirname,"./public/assets"),
|
||||
filename: "bundle.js",
|
||||
chunkFilename: isProduction ? "[contenthash:16].js" : "[name]-[contenthash:5].js",
|
||||
publicPath: "",
|
||||
clean: true
|
||||
},
|
||||
resolve: {
|
||||
extensions: [
|
||||
'.js',
|
||||
'.jsx',
|
||||
'.ts',
|
||||
'.tsx',
|
||||
'.css',
|
||||
'.scss',
|
||||
'.jpg',
|
||||
'.jpeg',
|
||||
'.png',
|
||||
'.svg'
|
||||
]
|
||||
},
|
||||
optimization:{
|
||||
splitChunks:{
|
||||
chunks: 'async'
|
||||
},
|
||||
chunkIds: "size",
|
||||
moduleIds: "size",
|
||||
mangleExports: "size"
|
||||
},
|
||||
stats: {
|
||||
logging: 'warn',
|
||||
},
|
||||
cache: {
|
||||
type: 'filesystem',
|
||||
cacheLocation: resolve(__dirname, '.cache'),
|
||||
cacheDirectory: resolve(__dirname, '.cache')
|
||||
},
|
||||
devtool: isProduction ? undefined : 'eval',
|
||||
target:"web",
|
||||
module: {
|
||||
rules: [{
|
||||
test: /\.ttf/i,
|
||||
exclude: /node_modules/,
|
||||
loader:"file-loader",
|
||||
options: {
|
||||
name: 'fonts/ttf/[name].[ext]',
|
||||
},
|
||||
},{
|
||||
test: /\.woff2?/i,
|
||||
exclude: /node_modules/,
|
||||
loader:"file-loader",
|
||||
options: {
|
||||
name: 'fonts/woff2/[name].[ext]',
|
||||
},
|
||||
},{
|
||||
test: /\.eot$/i,
|
||||
exclude: /node_modules/,
|
||||
loader:"file-loader",
|
||||
options: {
|
||||
name: 'fonts/eot/[name].[ext]',
|
||||
},
|
||||
},{
|
||||
test: /\.(jpe?g|png|svg|web[pm])$/i,
|
||||
exclude: /node_modules/,
|
||||
loader:"file-loader",
|
||||
options: {
|
||||
name: 'images/[name].[ext]',
|
||||
},
|
||||
},{
|
||||
test: /.jsx?$/,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
presets: [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
"targets": {
|
||||
"browsers": ["last 2 Chrome versions"]
|
||||
}
|
||||
}
|
||||
],
|
||||
"@babel/preset-react"
|
||||
],
|
||||
plugins: [
|
||||
"@babel/plugin-transform-runtime",
|
||||
["@babel/plugin-proposal-class-properties", { "loose": true }]
|
||||
]
|
||||
}
|
||||
}
|
||||
},{
|
||||
test: /\.s[ac]ss$|\.css$/i,
|
||||
exclude: /node_modules/,
|
||||
use: [
|
||||
"style-loader",
|
||||
"css-loader",
|
||||
"sass-loader"
|
||||
]
|
||||
},{
|
||||
test: /\.tsx?$/i,
|
||||
exclude: /node_modules/,
|
||||
use: {
|
||||
loader: 'ts-loader',
|
||||
options: {
|
||||
transpileOnly: true
|
||||
}
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue