How to avoid "TypeError: popper.js.map is not a valid URL" message
How to avoid "TypeError: popper.js.map is not a valid URL" message
我是 NodeJS、React 和 Webpack 的新手。我已经安装了需要 popper.js 的 bootstrap。当我 运行 我的应用程序一切正常但我在 Firefox 的控制台中遇到这样的错误:
文件package.json
{
"name": "basketmetrics2",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "nodemon --exec babel-node src/server/server.js",
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack --mode production"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/cli": "^7.2.3",
"@babel/core": "^7.3.3",
"@babel/node": "^7.2.2",
"@babel/preset-env": "^7.3.1",
"@babel/preset-react": "^7.0.0",
"babel-loader": "^8.0.5",
"babel-plugin-transform-class-properties": "^6.24.1",
"css-loader": "^2.1.0",
"file-loader": "^3.0.1",
"html-webpack-plugin": "^3.2.0",
"node-sass": "^4.11.0",
"nodemon": "^1.18.10",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"url-loader": "^1.1.2",
"webpack": "^4.29.4",
"webpack-dev-middleware": "^3.5.2",
"webpack-livereload-plugin": "^2.2.0"
},
"dependencies": {
"bootstrap": "^4.3.1",
"express": "^4.16.4",
"jquery": "^3.3.1",
"react": "^16.8.2",
"react-bootstrap": "^1.0.0-beta.5",
"react-dom": "^16.8.2"
}
}
文件webpack.config.js
import webpack from "webpack";
import htmlWebpackPlugin from "html-webpack-plugin";
import LiveReloadPlugin from "webpack-livereload-plugin";
export default {
mode: "development",
entry: "./src/client/index.js",
output: {
path: "/",
filename: "bundle.js"
},
module: {
rules: [
{
use: {
loader: "babel-loader"
},
test: /\.js$/,
exclude: /node_modules/
},
{
use: ["style-loader", "css-loader"],
test: /\.css$/
},
{
test: /\.scss$/,
use: [
{
loader: "style-loader"
},
{
loader: "css-loader",
options: {
sourceMap: true
}
},
{
loader: "saas-loader",
options: {
sourceMap: true
}
}
]
},
{
test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
loader: "url-loader",
options: {
limit: 10000
}
}
]
},
plugins: [
new htmlWebpackPlugin({
template: "./src/client/index.html"
}),
new LiveReloadPlugin()
]
}
我曾尝试将此配置插件添加到我的 webpack.config.js 文件中,但它对我不起作用:(
module.exports = {
// other configs
plugins: [
new htmlWebpackPlugin({
template: "./src/client/index.html"
}),
new LiveReloadPlugin(),
new webpack.SourceMapDevToolPlugin({
exclude: ['popper.js']
})
]
}
我不知道我做错了什么。如何配置我的应用程序以避免此类错误?
编辑我:
如果我修改我的 webpack.config.js 文件,将此条目 "new webpack.SourceMapDevToolPlugin()" 添加到插件,它对我不起作用:(
import webpack from "webpack";
import htmlWebpackPlugin from "html-webpack-plugin";
import LiveReloadPlugin from "webpack-livereload-plugin";
export default {
mode: "development",
entry: "./src/client/index.js",
output: {
path: "/",
filename: "bundle.js"
},
module: {
rules: [
{
use: {
loader: "babel-loader"
},
test: /\.js$/,
exclude: /node_modules/
},
{
use: ["style-loader", "css-loader"],
test: /\.css$/
},
{
test: /\.scss$/,
use: [
{
loader: "style-loader"
},
{
loader: "css-loader",
options: {
sourceMap: true
}
},
{
loader: "saas-loader",
options: {
sourceMap: true
}
}
]
},
{
test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
loader: "url-loader",
options: {
limit: 10000
}
}
]
},
plugins: [
new htmlWebpackPlugin({
template: "./src/client/index.html"
}),
new LiveReloadPlugin(),
new webpack.SourceMapDevToolPlugin()
]
}
这是警告,不是错误。它的发生是因为 devtools 正在尝试查找 pooper.js 的 sourcemap 文件,而您已在配置文件中排除了这些文件。
在配置中:
new webpack.SourceMapDevToolPlugin({
exclude: ['popper.js']
})
应替换为
new webpack.SourceMapDevToolPlugin()
此外,尝试在 webpack 配置文件中添加 devtool: 'eval-source-map',
我是 NodeJS、React 和 Webpack 的新手。我已经安装了需要 popper.js 的 bootstrap。当我 运行 我的应用程序一切正常但我在 Firefox 的控制台中遇到这样的错误:
文件package.json
{
"name": "basketmetrics2",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "nodemon --exec babel-node src/server/server.js",
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack --mode production"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/cli": "^7.2.3",
"@babel/core": "^7.3.3",
"@babel/node": "^7.2.2",
"@babel/preset-env": "^7.3.1",
"@babel/preset-react": "^7.0.0",
"babel-loader": "^8.0.5",
"babel-plugin-transform-class-properties": "^6.24.1",
"css-loader": "^2.1.0",
"file-loader": "^3.0.1",
"html-webpack-plugin": "^3.2.0",
"node-sass": "^4.11.0",
"nodemon": "^1.18.10",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"url-loader": "^1.1.2",
"webpack": "^4.29.4",
"webpack-dev-middleware": "^3.5.2",
"webpack-livereload-plugin": "^2.2.0"
},
"dependencies": {
"bootstrap": "^4.3.1",
"express": "^4.16.4",
"jquery": "^3.3.1",
"react": "^16.8.2",
"react-bootstrap": "^1.0.0-beta.5",
"react-dom": "^16.8.2"
}
}
文件webpack.config.js
import webpack from "webpack";
import htmlWebpackPlugin from "html-webpack-plugin";
import LiveReloadPlugin from "webpack-livereload-plugin";
export default {
mode: "development",
entry: "./src/client/index.js",
output: {
path: "/",
filename: "bundle.js"
},
module: {
rules: [
{
use: {
loader: "babel-loader"
},
test: /\.js$/,
exclude: /node_modules/
},
{
use: ["style-loader", "css-loader"],
test: /\.css$/
},
{
test: /\.scss$/,
use: [
{
loader: "style-loader"
},
{
loader: "css-loader",
options: {
sourceMap: true
}
},
{
loader: "saas-loader",
options: {
sourceMap: true
}
}
]
},
{
test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
loader: "url-loader",
options: {
limit: 10000
}
}
]
},
plugins: [
new htmlWebpackPlugin({
template: "./src/client/index.html"
}),
new LiveReloadPlugin()
]
}
我曾尝试将此配置插件添加到我的 webpack.config.js 文件中,但它对我不起作用:(
module.exports = {
// other configs
plugins: [
new htmlWebpackPlugin({
template: "./src/client/index.html"
}),
new LiveReloadPlugin(),
new webpack.SourceMapDevToolPlugin({
exclude: ['popper.js']
})
]
}
我不知道我做错了什么。如何配置我的应用程序以避免此类错误?
编辑我:
如果我修改我的 webpack.config.js 文件,将此条目 "new webpack.SourceMapDevToolPlugin()" 添加到插件,它对我不起作用:(
import webpack from "webpack";
import htmlWebpackPlugin from "html-webpack-plugin";
import LiveReloadPlugin from "webpack-livereload-plugin";
export default {
mode: "development",
entry: "./src/client/index.js",
output: {
path: "/",
filename: "bundle.js"
},
module: {
rules: [
{
use: {
loader: "babel-loader"
},
test: /\.js$/,
exclude: /node_modules/
},
{
use: ["style-loader", "css-loader"],
test: /\.css$/
},
{
test: /\.scss$/,
use: [
{
loader: "style-loader"
},
{
loader: "css-loader",
options: {
sourceMap: true
}
},
{
loader: "saas-loader",
options: {
sourceMap: true
}
}
]
},
{
test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
loader: "url-loader",
options: {
limit: 10000
}
}
]
},
plugins: [
new htmlWebpackPlugin({
template: "./src/client/index.html"
}),
new LiveReloadPlugin(),
new webpack.SourceMapDevToolPlugin()
]
}
这是警告,不是错误。它的发生是因为 devtools 正在尝试查找 pooper.js 的 sourcemap 文件,而您已在配置文件中排除了这些文件。
在配置中:
new webpack.SourceMapDevToolPlugin({
exclude: ['popper.js']
})
应替换为
new webpack.SourceMapDevToolPlugin()
此外,尝试在 webpack 配置文件中添加 devtool: 'eval-source-map',