wclr / yalc

Work with yarn/npm packages locally like a boss.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Import statements not resolving when using `yalc link`

AllenAttuned opened this issue · comments

commented

Environment:

  • macOS 12.6
  • Node v16.15.0
  • NPM v8.16.0
  • WebStorm

This might be more of an IDE or Node.js issue, but it's stumped me for a while.

As stated in the docs, when using yalc link a symlink is created in the project's node_modules directory which points to the project's .yalc/<some lib> directory. For my situation, this works great as I do not want to modify the project's package.json file.

The issue I'm having is withimport statements and type definitions. import statements do resolve, so this might be a pure IDE issue, but if instead of "linking" the Yalc dependency I use yalc add, the aforementioned issues don't occur.

This is the build process that I'm following:

build:
	npx tspc
	NODE_ENV=${env} npx babel src \
	--out-dir ${output_dir} \
	--extensions '.ts','.js','.tsx','.jsx' \

local_pub: clean_build
local_pub:
	npx yalc publish
	npx yalc push
	cd ${yalc_global_package_path} && \
		npm install