Я пытаюсь загрузить локальный JSON объект в мое Vuex
хранилище, используя const tree = import('@/articles/tree.json');
. Я включил "resolveJsonModule": true,
в моем tsconfig.json
, он нормально загружается, но NPM
выводит спам с предупреждениями, такими как:
WARNING in /home/benjamin/dev/learn-wgpu2/src/articles/tree.json(1,8654):
1:8654 Missing semicolon
Я думаю, что Webpack пытается задержать JSON как файл Typescript. Как мне заставить его перестать это делать?
Вот файл json, о котором идет речь.
{"path":"src/articles/","name":"articles","display":"","type":"folder","children":[{"path":"src/articles//about.md","name":"about.md","display":"/about.md","type":"file"},{"path":"src/articles//beginner","name":"beginner","display":"/beginner","type":"folder","children":[{"path":"src/articles//beginner/tutorial1-window","name":"tutorial1-window","display":"/beginner/tutorial1-window","type":"folder","children":[{"path":"src/articles//beginner/tutorial1-window/README.md","name":"README.md","display":"/beginner/tutorial1-window/README.md","type":"file"}]},{"path":"src/articles//beginner/tutorial2-swapchain","name":"tutorial2-swapchain","display":"/beginner/tutorial2-swapchain","type":"folder","children":[{"path":"src/articles//beginner/tutorial2-swapchain/README.md","name":"README.md","display":"/beginner/tutorial2-swapchain/README.md","type":"file"},{"path":"src/articles//beginner/tutorial2-swapchain/cleared-window.png","name":"cleared-window.png","display":"/beginner/tutorial2-swapchain/cleared-window.png","type":"file"}]},{"path":"src/articles//beginner/tutorial3-pipeline","name":"tutorial3-pipeline","display":"/beginner/tutorial3-pipeline","type":"folder","children":[{"path":"src/articles//beginner/tutorial3-pipeline/README.md","name":"README.md","display":"/beginner/tutorial3-pipeline/README.md","type":"file"},{"path":"src/articles//beginner/tutorial3-pipeline/tutorial3-pipeline-composite.svg","name":"tutorial3-pipeline-composite.svg","display":"/beginner/tutorial3-pipeline/tutorial3-pipeline-composite.svg","type":"file"},{"path":"src/articles//beginner/tutorial3-pipeline/tutorial3-pipeline-triangle.png","name":"tutorial3-pipeline-triangle.png","display":"/beginner/tutorial3-pipeline/tutorial3-pipeline-triangle.png","type":"file"},{"path":"src/articles//beginner/tutorial3-pipeline/tutorial3-pipeline-vertices.png","name":"tutorial3-pipeline-vertices.png","display":"/beginner/tutorial3-pipeline/tutorial3-pipeline-vertices.png","type":"file"},{"path":"src/articles//beginner/tutorial3-pipeline/tutorial3-pipeline-vertices.svg","name":"tutorial3-pipeline-vertices.svg","display":"/beginner/tutorial3-pipeline/tutorial3-pipeline-vertices.svg","type":"file"}]},{"path":"src/articles//beginner/tutorial4-buffer","name":"tutorial4-buffer","display":"/beginner/tutorial4-buffer","type":"folder","children":[{"path":"src/articles//beginner/tutorial4-buffer/README.md","name":"README.md","display":"/beginner/tutorial4-buffer/README.md","type":"file"},{"path":"src/articles//beginner/tutorial4-buffer/figures.svg","name":"figures.svg","display":"/beginner/tutorial4-buffer/figures.svg","type":"file"},{"path":"src/articles//beginner/tutorial4-buffer/gradient.png","name":"gradient.png","display":"/beginner/tutorial4-buffer/gradient.png","type":"file"},{"path":"src/articles//beginner/tutorial4-buffer/indexed-pentagon.png","name":"indexed-pentagon.png","display":"/beginner/tutorial4-buffer/indexed-pentagon.png","type":"file"},{"path":"src/articles//beginner/tutorial4-buffer/pentagon.png","name":"pentagon.png","display":"/beginner/tutorial4-buffer/pentagon.png","type":"file"},{"path":"src/articles//beginner/tutorial4-buffer/triangle.png","name":"triangle.png","display":"/beginner/tutorial4-buffer/triangle.png","type":"file"},{"path":"src/articles//beginner/tutorial4-buffer/vb_desc.png","name":"vb_desc.png","display":"/beginner/tutorial4-buffer/vb_desc.png","type":"file"}]},{"path":"src/articles//beginner/tutorial5-textures","name":"tutorial5-textures","display":"/beginner/tutorial5-textures","type":"folder","children":[{"path":"src/articles//beginner/tutorial5-textures/README.md","name":"README.md","display":"/beginner/tutorial5-textures/README.md","type":"file"},{"path":"src/articles//beginner/tutorial5-textures/address_mode.png","name":"address_mode.png","display":"/beginner/tutorial5-textures/address_mode.png","type":"file"},{"path":"src/articles//beginner/tutorial5-textures/address_mode.xcf","name":"address_mode.xcf","display":"/beginner/tutorial5-textures/address_mode.xcf","type":"file"},{"path":"src/articles//beginner/tutorial5-textures/happy-tree-uv-coords.png","name":"happy-tree-uv-coords.png","display":"/beginner/tutorial5-textures/happy-tree-uv-coords.png","type":"file"},{"path":"src/articles//beginner/tutorial5-textures/happy-tree-uv-coords.xcf","name":"happy-tree-uv-coords.xcf","display":"/beginner/tutorial5-textures/happy-tree-uv-coords.xcf","type":"file"},{"path":"src/articles//beginner/tutorial5-textures/happy-tree.png","name":"happy-tree.png","display":"/beginner/tutorial5-textures/happy-tree.png","type":"file"},{"path":"src/articles//beginner/tutorial5-textures/happy-tree.xcf","name":"happy-tree.xcf","display":"/beginner/tutorial5-textures/happy-tree.xcf","type":"file"},{"path":"src/articles//beginner/tutorial5-textures/rightside-up.png","name":"rightside-up.png","display":"/beginner/tutorial5-textures/rightside-up.png","type":"file"},{"path":"src/articles//beginner/tutorial5-textures/upside-down.png","name":"upside-down.png","display":"/beginner/tutorial5-textures/upside-down.png","type":"file"}]},{"path":"src/articles//beginner/tutorial6-uniforms","name":"tutorial6-uniforms","display":"/beginner/tutorial6-uniforms","type":"folder","children":[{"path":"src/articles//beginner/tutorial6-uniforms/README.md","name":"README.md","display":"/beginner/tutorial6-uniforms/README.md","type":"file"},{"path":"src/articles//beginner/tutorial6-uniforms/newtranspipe.png","name":"newtranspipe.png","display":"/beginner/tutorial6-uniforms/newtranspipe.png","type":"file"},{"path":"src/articles//beginner/tutorial6-uniforms/static-tree.png","name":"static-tree.png","display":"/beginner/tutorial6-uniforms/static-tree.png","type":"file"}]},{"path":"src/articles//beginner/tutorial7-instancing","name":"tutorial7-instancing","display":"/beginner/tutorial7-instancing","type":"folder","children":[{"path":"src/articles//beginner/tutorial7-instancing/README.md","name":"README.md","display":"/beginner/tutorial7-instancing/README.md","type":"file"},{"path":"src/articles//beginner/tutorial7-instancing/forest.png","name":"forest.png","display":"/beginner/tutorial7-instancing/forest.png","type":"file"},{"path":"src/articles//beginner/tutorial7-instancing/instance_texture.png","name":"instance_texture.png","display":"/beginner/tutorial7-instancing/instance_texture.png","type":"file"},{"path":"src/articles//beginner/tutorial7-instancing/instance_texture_scaled.png","name":"instance_texture_scaled.png","display":"/beginner/tutorial7-instancing/instance_texture_scaled.png","type":"file"},{"path":"src/articles//beginner/tutorial7-instancing/instance_texture_scaled.xcf","name":"instance_texture_scaled.xcf","display":"/beginner/tutorial7-instancing/instance_texture_scaled.xcf","type":"file"}]},{"path":"src/articles//beginner/tutorial8-depth","name":"tutorial8-depth","display":"/beginner/tutorial8-depth","type":"folder","children":[{"path":"src/articles//beginner/tutorial8-depth/README.md","name":"README.md","display":"/beginner/tutorial8-depth/README.md","type":"file"},{"path":"src/articles//beginner/tutorial8-depth/forest.xcf","name":"forest.xcf","display":"/beginner/tutorial8-depth/forest.xcf","type":"file"},{"path":"src/articles//beginner/tutorial8-depth/forest_fixed.png","name":"forest_fixed.png","display":"/beginner/tutorial8-depth/forest_fixed.png","type":"file"},{"path":"src/articles//beginner/tutorial8-depth/forest_with_zoom.png","name":"forest_with_zoom.png","display":"/beginner/tutorial8-depth/forest_with_zoom.png","type":"file"},{"path":"src/articles//beginner/tutorial8-depth/forest_with_zoom.xcf","name":"forest_with_zoom.xcf","display":"/beginner/tutorial8-depth/forest_with_zoom.xcf","type":"file"}]},{"path":"src/articles//beginner/tutorial9-models","name":"tutorial9-models","display":"/beginner/tutorial9-models","type":"folder","children":[{"path":"src/articles//beginner/tutorial9-models/README.md","name":"README.md","display":"/beginner/tutorial9-models/README.md","type":"file"},{"path":"src/articles//beginner/tutorial9-models/cube-diffuse.jpg","name":"cube-diffuse.jpg","display":"/beginner/tutorial9-models/cube-diffuse.jpg","type":"file"},{"path":"src/articles//beginner/tutorial9-models/cubes-correct.png","name":"cubes-correct.png","display":"/beginner/tutorial9-models/cubes-correct.png","type":"file"},{"path":"src/articles//beginner/tutorial9-models/cubes.png","name":"cubes.png","display":"/beginner/tutorial9-models/cubes.png","type":"file"}]}]},{"path":"src/articles//hello.md","name":"hello.md","display":"/hello.md","type":"file"},{"path":"src/articles//tree.json","name":"tree.json","display":"/tree.json","type":"file"}]}
Я использую эти данные, чтобы переписать мой учебник / блог sotrh.github.io/learn-wgpu.