Skip to content

helloboy12345/resolver

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting started

git clone https://github.com/eunchurn/nodejs-babel-starter
rm -rf .git

change package.json to your own

npm install

or

yarn

done.

Flow-typed install

yarn flow:install

Flow check

yarn flow:check

Test

yarn test

Module resolve path configuration

import something from 'libs/module'

instead of

import something from '../../../../../libs/module'

example configuration

ESLint

Edit .eslintrc

{
  "settings": {
    "import/resolver": {
      "alias": {
        "map": [
          ["src", "./src/"],
          ["libs", "./src/libs/"],
          ["build", "./build/Release/"]
        ],
        "extensions": [".js", ".json"]
      }
    }
  },
}

Babel

{
  "plugins": [
    [
      "module-resolver",
      {
        "root": ["./"],
        "alias": {
          "@src": "./src",
          "@libs": "./src/libs",
          "@build": "./build/Release"
        }
      }
    ]
  ]
}

VSCode

Edit .vscode/jsconfig.json

{
  "compilerOptions": {
    "baseUrl": "./",
    "paths": {
      "src/*": ["src/*"],
      "libs/*": ["src/libs/*"],
      "build/*": ["build/Release/*"]
    }
  }
}

Flow-type

Edit .flowconfig

[options]
module.file_ext=.node
module.name_mapper='build' ->
'<PROJECT_ROOT>/build/Release'
module.file_ext=.js
module.name_mapper='libs' ->
'<PROJECT_ROOT>/src/libs'
module.file_ext=.js
module.name_mapper='src' ->
'<PROJECT_ROOT>/src'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 76.8%
  • HTML 18.8%
  • Shell 4.4%