我使用jsoneditorNPM 库。jsoneditor包含一个svg加载via import 'jsoneditor/dist/jsoneditor.css';。但它给了我这个错误。看起来next.config.js没有正确加载 SVG。
ModuleParseError: Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
| <svg
| xmlns:dc="http://purl.org/dc/elements/1.1/"
Run Code Online (Sandbox Code Playgroud)
以下是我当前的 nextjs 配置。
module.exports = {
webpack: (config, options) => {
config.module.rules.push({
test: /\.svg$/,
use: ["@svgr/webpack"]
});
return config;
},
...withImages(withCSS({
cssModules: true,
cssLoaderOptions: {
importLoaders: 1,
localIdentName: …Run Code Online (Sandbox Code Playgroud) 在升级我的nodejs(以前是8,现在是12)和Angular(以前是7,现在是10)之前,我使用的是ang-jsoneditor。升级后,ang-jsoneditor 似乎不起作用,错误是
\ncore.js:4442 ERROR TypeError: Cannot read property \'nativeElement\' of undefined\n at JsonEditorComponent.ngOnInit (ang-jsoneditor.js:50)\n at callHook (core.js:3281)\n at callHooks (core.js:3251)\n at executeInitAndCheckHooks (core.js:3203)\n at selectIndexInternal (core.js:6324)\n at Module.\xc9\xb5\xc9\xb5advance (core.js:6306)\n at NewConfigurationEditorComponent_Template (new-configuration-editor.component.html:72)\n at executeTemplate (core.js:7511)\n at refreshView (core.js:7380)\n at refreshComponent (core.js:8527)\nRun Code Online (Sandbox Code Playgroud)\n我访问了主页https://github.com/mariohmol/ang-jsoneditor,它说只支持4到9的角度。这是我的package.json,请指教。
\n{\n "name": "configuration-service",\n "version": "0.0.0",\n "scripts": {\n "ng": "ng",\n "start": "ng serve",\n "build": "ng build --prod --aot --output-hashing all",\n "test": "ng test",\n "lint": "ng lint",\n "e2e": "ng e2e"\n },\n "private": true,\n "dependencies": {\n …Run Code Online (Sandbox Code Playgroud)