electrode-io / electrode-confippet

node.js environment aware application configuration
Other
108 stars 18 forks source link

Module not found: Error: Cannot resolve module 'fs' #11

Closed Eric013 closed 7 years ago

Eric013 commented 7 years ago

Hello,

When i use electrode-confippet in my code (anywhere in ./electrode/client): ../services/api.js

import axios from 'axios';

const config = require("electrode-confippet").config;
const BASE_URL = config.$("api.url");

const instance = axios.create({
  baseURL: BASE_URL
});

export const API = instance;

(even if i just have require("electrode-confippet"))

I have errors:

WARNING in ./~/electrode-confippet/lib/ext-handlers.js
Critical dependencies:
7:8-15 require function is used in a way in which dependencies cannot be statically extracted
8:6-13 require function is used in a way in which dependencies cannot be statically extracted
 @ ./~/electrode-confippet/lib/ext-handlers.js 7:8-15 8:6-13

ERROR in ./~/electrode-confippet/lib/process-config.js
Module not found: Error: Cannot resolve module 'fs' in /Users/ericsanchez/Projects/projects-node/tproject/node_modules/electrode-confippet/lib
 @ ./~/electrode-confippet/lib/process-config.js 4:11-24

ERROR in ./~/electrode-confippet/lib/compose-config.js
Module not found: Error: Cannot resolve module 'fs' in /Users/ericsanchez/Projects/projects-node/tproject/node_modules/electrode-confippet/lib
 @ ./~/electrode-confippet/lib/compose-config.js 4:11-24

ERROR in ./~/electrode-confippet/lib/ext-handlers.js
Module not found: Error: Cannot resolve module 'fs' in /Users/ericsanchez/Projects/projects-node/tproject/node_modules/electrode-confippet/lib
 @ ./~/electrode-confippet/lib/ext-handlers.js 4:11-24

Whereas i use require("electrode-confippet").config in electrode/server/ it's ok... An idea ? Thanks.

animesh10 commented 7 years ago

Hi @Eric013, as you have noticed, confippet is using the filesystem and can only be used on the server side.

Miteshivgroup commented 7 years ago

Hi @animesh10 , is there any way to get the confippet on client side ?