Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate and prioritize built-in Node modules over 3rd party modules #56

Closed
AramC92 opened this issue May 8, 2021 · 1 comment
Closed
Labels

Comments

@AramC92
Copy link

AramC92 commented May 8, 2021

Is it possible prioritize Node's built-in modules over 3rd party modules?

Given the following imports:

import path from 'path'
import cookieSession from 'cookie-session'
import cors from 'cors'
import favicon from 'serve-favicon'
import 'express-async-errors'
import { createProxyMiddleware } from 'http-proxy-middleware'
import express from 'express'

The plugin will output the following after formatting

import cookieSession from 'cookie-session'
import cors from 'cors'
import express from 'express'
import 'express-async-errors'
import { createProxyMiddleware } from 'http-proxy-middleware'
import path from 'path'
import favicon from 'serve-favicon'

But would be nice if built-in modules like path, fs, util, etc are prioritized

import path from 'path'

import cookieSession from 'cookie-session'
import cors from 'cors'
import express from 'express'
import 'express-async-errors'
import { createProxyMiddleware } from 'http-proxy-middleware'
import favicon from 'serve-favicon'

Even the following config would not solve this because these built-in modules would appear after and not before.

"importOrder": [
  "^(assert|buffer|child_process|cluster|crypto|dgram|dns|domain|events|fs|http|https|net|os|path|punycode|querystring|readline|stream|string_decoder|timers|tls|tty|url|util|v8|vm|zlib)$",
  "^[./]"
],

Undesired result (path is not prioritized):

import cookieSession from 'cookie-session'
import cors from 'cors'
import express from 'express'
import 'express-async-errors'
import { createProxyMiddleware } from 'http-proxy-middleware'
import favicon from 'serve-favicon'

import path from 'path'
@ayusharma
Copy link
Collaborator

Duplicate #65

@ayusharma ayusharma added the v3 label Aug 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants