I'm trying to import json file and use it as js object inside webpack.config.js:
const config = require("json-loader!./config.json");
but i get:
Error: Cannot find module 'json-loader!./config.json'
What's the tactic here? What's the preferred way to load config files inside Webpack?
Related
In my VUE webproject I like to read a local JSON.
This JSON should not be included in the webpack bundle.
From the Vue Cli help files:
"Any static assets placed in the public folder will simply be copied and not go through webpack. You need to reference them using absolute paths."
https://cli.vuejs.org/guide/html-and-static-assets.html#the-public-folder
I created the Hello-World application from VUE CLI with VUE 3.
Now when I import a static json from the public folder it does get copied as-is to the destination folder, but it get's included in the webpack bundle as well.
import config from '/public/config.json'
Any help is much appreciated!
I have a json file on this path: C:\Users\Joao\Desktop\ProjetoFinal_8150133\DadosExtraidosGOV
When I try to invoque call apoc.load.json(path)in Neo4j, it says this:
Failed to invoke procedure `apoc.load.json`: Caused by: java.lang.RuntimeException: Can't read url or key file:/C:/Users/Joao/.Neo4jDesktop/neo4jDatabases/database-ae613b5d-df8e-4180-af6f-d99159d18e86/installation-4.0.3/import/Users/Joao/Desktop/ProjetoFinal_8150133/DadosExtraidosGOV/new.json as json: C:\Users\Joao\.Neo4jDesktop\neo4jDatabases\database-ae613b5d-df8e-4180-af6f-d99159d18e86\installation-4.0.3\import\Users\Joao\Desktop\ProjetoFinal_8150133\DadosExtraidosGOV\new.json (system could not find the specified path)
So what should be my path to be able to use the call function? I've already set apoc.import.file.enabled=true in my neo4j.conf
[UPDATED]
By default, import files (that are local to the neo4j server) are expected to be in the server's import directory.
However, if you do not have access to the import directory (e.g., because you are using a different machine), then you can pass an http or https URL instead. It will be up to you to spin up a web server to serve that URL.
Tips: Python provides a simple way to create a local website that serves static files. And ngrok provides a simple way to get a public URL for a local website.
You need to set below settings in order to read any local files:
apoc.import.file.use_neo4j_config=false
According to the Neo4j official doc , By setting above config,
Neo4j will now be able to read from anywhere on the file system, so be
sure that this is your intention before setting this property.
I am using TypeScript as Compiler for Aurelia Project.Trying to load
'.json static file which is under the Project Folder'
I am getting the following error 404 status not found.
Tried to place json file at both inside and outside of SRC folder but unable to load the Json file.
If I miss any like setting up a configuration then please guide me.
Here is Code and Json Data and error
you typically wouldn't fetch a static json like this unless you had a task in your webpack to copy the file to your dist folder. the webpack dev server you are running with aurelia cli au run command doesn't know about the file unless you copy it or import the json somewhere. typescript supports json import as of typescript 2.9 if you have resolveJsonModule: true in the tsconfig.json file. that means you just need to `import json from '.\JsonRead.ts'.
In this case, since the file is directly in the project you don't need HttpClient at all. Simply import the file directly.
import jsonRead from "./JsonRead.json";
export class App {
message = 'Hello World';
bind(){
const json = JSON.stringify(jsonRead);
console.log(json);
}
}
Remember to enable "resolveJsonModule": true at tsconfig.json file for this to work.
If you want to use HttpClient, your json file needs to be inside static folder for webpack to pack it as public file.
I have created a react app using create-react-app and running it using command
set HTTPS=true&&npm start. Also, I'm using the axios for AJAX call.
In the app, I want to use the mock data from the JSON files which are in the local directory under the src/shared/mockdata folder but somehow I'm getting the 404 error/ Cannot GET /assets/logo-80x80.png though I have given the full path https://localhost:3000/shared/mockdata/current.json and this same thing is happening with loading the images as well.
I used npm run eject and tried it by setting the value false of disableDotRule of histodisableDotRuleryApiFallback in webpackDevserver.config.js file.
json file containing data and index.html in the Node app are in the same top directory. Using d3 js i am calling the json file to load data for visualization. But i am getting http error 404 while loading the node app. Any suggestions?