Comments (10)
Thanks for reports.
I try to reproduce it, but I can not reproduce it.
✈ node -v
v8.12.0
~/.ghq/github.com/azu/rc-config-loader-issue-2
✈ cat example.js
const rcfile = require("rc-config-loader");
~/.ghq/github.com/azu/rc-config-loader-issue-2
✈ node example.js
Related:
from rc-config-loader.
I've seen same error(Module not found: Can't resolve 'module') on webpack.
- Can't resolve 'module' in '...../node_modules/prettier' · Issue #4879 · prettier/prettier
- Module not found: Error: Can't resolve 'module' in '...' · Issue #5423 · webpack/webpack
Is this issue related to that?
from rc-config-loader.
I create branch that reproduce issue
Reproduction
git clone https://github.com/ravecat/mendeleev.git --single-branch --branch rc-config-loader-issue
yarn
I have code in src/common/Media/responsive/index.js
/* eslint-disable */
import { css } from "styled-components";
const rcfile = require("rc-config-loader");
const responsive = (property, resolution) => {
console.log(rcfile('sct'))
return css`
@media (max-width: ${resolution}px) {
${property};
}
`;
}
export default responsive;
In same folder I also exist .sctrc
file
from rc-config-loader.
I've seen same error(Module not found: Can't resolve 'module') on webpack.
- Can't resolve 'module' in '...../node_modules/prettier' · Issue #4879 · prettier/prettier
- Module not found: Error: Can't resolve 'module' in '...' · Issue #5423 · webpack/webpack
Is this issue related to that?
I need check, probably it's related
from rc-config-loader.
Thanks.
I tried this repository and `yarn test` work fine in my env.
~/.ghq/github.com/azu/testa/mendeleev $ node -v v8.12.0 ~/.ghq/github.com/azu/testa/mendeleev $ yarn -v 1.9.4 $ yarn # install.. $ yarn test PASS src/common/Media/responsive/index.test.js ● Consoleconsole.log src/common/Media/responsive/index.js:6 { config: { responsive: [ 1023, 1600 ] }, filePath: '/Users/azu/.ghq/github.com/azu/testa/mendeleev/.sctrc' }
PASS src/App.test.js
● Consoleconsole.log src/common/Media/responsive/index.js:6 { config: { responsive: [ 1023, 1600 ] }, filePath: '/Users/azu/.ghq/github.com/azu/testa/mendeleev/.sctrc' } console.log src/common/Media/responsive/index.js:6 { config: { responsive: [ 1023, 1600 ] }, filePath: '/Users/azu/.ghq/github.com/azu/testa/mendeleev/.sctrc' } console.log src/common/Media/responsive/index.js:6 { config: { responsive: [ 1023, 1600 ] }, filePath: '/Users/azu/.ghq/github.com/azu/testa/mendeleev/.sctrc' } console.log src/common/Media/responsive/index.js:6 { config: { responsive: [ 1023, 1600 ] }, filePath: '/Users/azu/.ghq/github.com/azu/testa/mendeleev/.sctrc' }
Test Suites: 3 passed, 3 total
Tests: 4 passed, 4 total
Snapshots: 0 total
Time: 14.001s
Ran all test suites.Watch Usage: Press w to show more.
✨ Done in 31.79s.
But, I've confirmed that
yarn start
is failed.This error is caused by webpack.
Because, webpack can not treatmodule
module.You can avoid this error with following patch.
diff --git a/config/webpack.config.dev.js b/config/webpack.config.dev.js index 36d1767..6da9f84 100644 --- a/config/webpack.config.dev.js +++ b/config/webpack.config.dev.js @@ -118,6 +118,7 @@ module.exports = { node: { dgram: "empty", fs: "empty", + module: "empty", net: "empty", tls: "empty", child_process: "empty" diff --git a/config/webpack.config.prod.js b/config/webpack.config.prod.js index 047b7f8..5399e97 100644 --- a/config/webpack.config.prod.js +++ b/config/webpack.config.prod.js @@ -203,6 +203,7 @@ module.exports = { node: { dgram: "empty", fs: "empty", + module: "empty", net: "empty", tls: "empty", child_process: "empty"I've submitted a PR to fix this issue.
from rc-config-loader.
ravecat commented on May 30, 2024 @azu thank you very match, I will include your solution in extended functionality!
from rc-config-loader.
azu commented on May 30, 2024 No problem.
from rc-config-loader.
ravecat commented on May 30, 2024 @azu Sorry for interrupt, but I want to clarify some questions
Accorind sources, if I haven't options
rc-config-loader
use default path for search - current directoryconst configFileName = opts.configFileName || `.${pkgName}rc`;
So I use loader without options and get
undefined
. Code available like previous comment
git clone https://github.com/ravecat/mendeleev.git --single-branch --branch rc-config-loader-issue
yarn
I have code in
src/common/Media/helpers/getConfig.js
const rcfile = require("rc-config-loader"); const getConfig = () => { console.log(rcfile("sct")); debugger return } export default getConfigand try to use in
src/common/Media/responsive/index.js
import { css } from "styled-components"; import getConfig from '../helpers/getConfig' const responsive = (property, resolution) => { const resolutions = getConfig() return css` @media (max-width: ${resolution}px) { ${property}; } `; } export default responsive;Probably it's again webpack settings relative with resolve options, but I use relative path, not absolute
from rc-config-loader.
azu commented on May 30, 2024 Can you create it as new issue?
from rc-config-loader.
ravecat commented on May 30, 2024 from rc-config-loader.
Related Issues (8)
Recommend Projects
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
TensorFlow
An Open Source Machine Learning Framework for Everyone
Django
The Web framework for perfectionists with deadlines.
Laravel
A PHP framework for web artisans
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
Recommend Topics
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
web
Some thing interesting about web. New door for the world.
server
A server is a program made to process requests and deliver data to clients.
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Visualization
Some thing interesting about visualization, use data art
Game
Some thing interesting about game, make everyone happy.
Recommend Org
We are working to build community through open source technology. NB: members must have two-factor auth.
Microsoft
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba
Alibaba Open Source for everyone
D3
Data-Driven Documents codes.
Tencent
China tencent open source team.
Jobs
Jooble
from rc-config-loader.