У меня есть файл HTML, разрешенный Thymeleaf, который конфликтует с ReactJS.У меня есть Java-бэкэнд, использующий Spring и Thymeleaf, и ReactJS-интерфейс, использующий веб-плагин HTML-плагин, который строит страницу из шаблона, этот же шаблон использует тимилиф.Часть Thymeleaf находится за пределами реагирующей части, но веб-пакет конфликтует!
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
...
<!-- conflict -->
<input type="hidden" id="error_in_page" th:value="${error}">
<div id="my-app"></div>
Возможно ли НЕ разбирать некоторую часть HTML-кода?
это мой webpack.config.js
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: [
'./index.jsx'
],
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader']
},
{
test: /\.css$/,
use: [ 'style-loader', 'css-loader' ]
},
{
test: /\.(?:png|jpg|svg|gif|json|ttf|woff|woff2|eot)$/,
//test: /\.png$/,
use: ['url-loader']
},
{
test: /\.json/,
type: 'javascript/auto',
//use: [require.resolve('json-loader')]
use: ['json-loader']
}
]
},
resolve: {
extensions: ['*', '.js', '.jsx'],
symlinks: true
},
plugins: [
new webpack.ProvidePlugin({
"React": "react",
}),
new HtmlWebpackPlugin({
title: "MyApp",
template: "./src/main/templates/home/index.html",
filename: "home.html"
})
],
output: {
path: __dirname + '/src/main/webapp/',
publicPath: "/",
filename: 'my-app.js'
},
devServer: {
compress: true,
port: 5050,
host: '0.0.0.0',
historyApiFallback: true,
contentBase: './src/main/webapp/home'
}
};
когда я запускаю npm run build
у меня появляется эта ошибка
ERROR in Template execution failed: ReferenceError: error is not defined