import React from 'react';
import ReactDOM from 'react-dom'; /* для работы с веб страницами */ // модуль React для работы с веб-страницами
import ProductList from '/js/components/ProductList.js';
const tableName = "Таблица продуктов";
const tableColName = {
name: "название",
price: "цена",
src: "фотография",
quality: "кол-во ед"
};
const product = require('/js/data/products.json');
ReactDOM.render(<ProductList name={tableName} colname={tableColName} product={product} />, document.getElementById('root'));
ReactDOM.render(<ProductList name={tableName} colname={tableColName} product={product} />, document.getElementById('root'));
bootstrap e072cea83c7263748e13:62 Uncaught Error: Module build failed: SyntaxError: C:\Users\Anriko\Desktop\домашка реакт\FD3-Pauls\ishop3-b\src\index.js: Unexpected token (19:16)
[0m [90m 17 | [39m
[90m 18 | [39m
[31m[1m>[22m[39m[90m 19 | [39m[33mReactDOM[39m[33m.[39mrender([33m<[39m[33mProductList[39m name[33m=[39m{tableName} colname[33m=[39m{tableColName} product[33m=[39m{product} [33m/[39m[33m>[39m[33m,[39m document[33m.[39mgetElementById([32m'root'[39m))[33m;[39m
[90m | [39m [31m[1m^[22m[39m
[90m 20 | [39m[0m
const VueLoaderPlugin = require('vue-loader/lib/plugin');
module.exports = {
watch: true,
mode: 'none',
output: {
filename: 'main.js',
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
},
{
test: /\.(js)$/,
exclude: /(node_modules)/,
use: ['babel-loader', 'eslint-loader'],
},
],
},
plugins: [
new VueLoaderPlugin(),
],
};
сonst path = require('path');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const extractCSS = new ExtractTextPlugin({
filename: "bundle.css"
});
module.exports = {
entry: "./index.js", // основной файл приложения
output:{
path: path.resolve(__dirname, 'build'), // путь к каталогу выходных файлов
filename: "bundle.js" // название создаваемого файла
},
devtool:'source-map',
module:{
rules:[
{
test: /\.jsx?$/, // какие файлы обрабатывать
exclude: /node_modules/, // какие файлы пропускать
use: { loader: "babel-loader" }
},
{
test: /\.css$/,
use: extractCSS.extract({
use: ["css-loader"]
})
}
]
},
plugins: [
extractCSS
]
}
<script src="https://unpkg.com/@babel/standalone@7.15.5/babel.min.js"></script>
<script crossorigin src="https://unpkg.com/react@17/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"></script>
"@babel/core": "^7.13.16",
"@babel/polyfill": "^7.12.1",
"@babel/preset-env": "^7.13.15",
"@babel/preset-react": "^7.13.13",
"babel-loader": "^8.2.2",
ERROR in unable to locate 'C:/Users/Anriko/Desktop/домашка реакт/FD3-Pauls/ishop3/public/**/*' glob after filtering paths
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="./css/style.css">
</head>
<body>
<div id="root"></div>
<script src="./main.js"></script>
</body>
</html>