标签: jsoneditor

如何使用 next.config.js 从 node_modules 加载 svg?

我使用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)

svg reactjs webpack next.js jsoneditor

8
推荐指数
0
解决办法
532
查看次数

Angular 10 中有任何 json 编辑器吗?

在升级我的nodejs(以前是8,现在是12)和Angular(以前是7,现在是10)之前,我使用的是ang-jsoneditor。升级后,ang-jsoneditor 似乎不起作用,错误是

\n
core.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)\n
Run 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)

angular jsoneditor

2
推荐指数
1
解决办法
7989
查看次数

标签 统计

jsoneditor ×2

angular ×1

next.js ×1

reactjs ×1

svg ×1

webpack ×1