Skip to content

Configuration files not found when importing a file from outside the current project folder #2539

Closed
@Aymkdn

Description

Version

3.0.3

Reproduction link

https://github.com/Aymkdn/vue-cli-error

Node and OS info

Node 8.11.4 / npm 5.6.0 / Windows 10

Steps to reproduce

My structure is the one below:

parent/
├── common/
|   ├── Example.vue
└── demo/
    ├── public/
    ├── src/
    |   └── App.vue
    ├── .browserlistrc
    ├── .eslintrc
    ├── babel.config.js
    ├── package.json
    ├── etc...

demo has been created with vue create demo. I use the default settings. I've only changed the src/App.vue file (see below)

In App.vue I'd like to refer the file parent/common/Example.vue (in code):

import Example from '../../common/Example.vue'

Then if I run npm run serve I receive the below error:

Module build failed (from ./node_modules/eslint-loader/index.js):
Error: No ESLint configuration found.
    at Config.getLocalConfigHierarchy (C:\Users\aymkdn\Documents\PROJECTS\nodejs\proof\demo\node_modules\eslint\lib\config.js:255:39)
    at Config.getConfigHierarchy (C:\Users\aymkdn\Documents\PROJECTS\nodejs\proof\demo\node_modules\eslint\lib\config.js:179:43)
    at Config.getConfigVector (C:\Users\aymkdn\Documents\PROJECTS\nodejs\proof\demo\node_modules\eslint\lib\config.js:286:21)
    at Config.getConfig (C:\Users\aymkdn\Documents\PROJECTS\nodejs\proof\demo\node_modules\eslint\lib\config.js:329:29)
    at processText (C:\Users\aymkdn\Documents\PROJECTS\nodejs\proof\demo\node_modules\eslint\lib\cli-engine.js:163:33)
    at CLIEngine.executeOnText (C:\Users\aymkdn\Documents\PROJECTS\nodejs\proof\demo\node_modules\eslint\lib\cli-engine.js:620:17)
    at lint (C:\Users\aymkdn\Documents\PROJECTS\nodejs\proof\demo\node_modules\eslint-loader\index.js:237:17)
    at transform (C:\Users\aymkdn\Documents\PROJECTS\nodejs\proof\demo\node_modules\eslint-loader\index.js:215:18)
    at C:\Users\aymkdn\Documents\PROJECTS\nodejs\proof\demo\node_modules\loader-fs-cache\index.js:127:18
    at ReadFileContext.callback (C:\Users\aymkdn\Documents\PROJECTS\nodejs\proof\demo\node_modules\loader-fs-cache\index.js:31:14)
    at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:420:13)

I tried to ignore ESLint but then I receive an error from PostCSS :

Module build failed (from ./node_modules/postcss-loader/lib/index.js):
Error: No PostCSS Config found in: C:\Users\aymkdn\Documents\PROJECTS\nodejs\proof\demo\src
    at config.load.then (C:\Users\aymkdn\Documents\PROJECTS\nodejs\proof\demo\node_modules\postcss-load-config\src\index.js:55:15)
    at <anonymous>

What is expected?

I'd assume it would use the current project's config files to import files from somewhere else.

So using the current ESLint and other configurations defined in the current project.

What is actually happening?

The program tries to find configuration files from the outside folder instead of using its own config files, and because it cannot find them it fails.


I need that because I have the same code I'll need to import for different projects.

The behavior is the same with a simple JS file.

I also tried with a webpack alias, but same error.

Thank you.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions