-
Notifications
You must be signed in to change notification settings - Fork 71
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
Symlinks to files outside package root are not being compiled #188
Comments
Filesystem symlinks? What OS, soft or hard links? any change you can make a repo with reproduction? |
Windows opertating system. Created symlink using "npm link" option to external module. If module is installed then no problem. But to test locally we need to create symlinks and that is not working only with typescript2 plugin. With typescript1 plugin symlinks are working but enums are not working. |
The same issue, but I use lerna to link packages, and rollup complains unexpected token for the linked packages. |
exactly the same issue on windows with lerna |
@PavaniVaka @TerenceZ @thealjey any chance for a small repo with reproduction? |
@ezolenko Sorry, no. But I narrowed down the issue a bit. I noticed that if the external module is copied to application directory then it works. But if it is just symlink then it is not working. For ex: With yalc we can test the external dependencies easily. Because it creates yalc folder in application directory and copies external module to that folder and then creates symlink from yalc folder to node_modules. Hope this gives some clue. |
@ezolenko I have actually figured out what the problem was in my case and it has nothing to do with this plugin (it works perfectly) or symlinks for that matter. |
i think we are on the same page here.
@ezolenko https://github.com/moki/mokui there is one. |
I've resolved the issue #194, in case anyone encounters the same problem, below i am providing solution: When one attempts to build each separate package inside the monorepo, rollup attempts to resolve import json from "rollup-plugin-json";
const pkg = process.env.LERNA_PACKAGE_NAME &&
require(`${process.env.LERNA_PACKAGE_NAME}/package.json`);
const dependencies = ({ dependencies }) => Object.keys(dependencies || {});
const pkgdependencies = dependencies(pkg);
/* exported rollup configuration */
const config = {
/* your config goes here... */
/* id is the source name if list of dependencies includes
* id source name, then mark it as external,
*/
external: id => pkgdependencies.includes(id)
};
export default config; |
same issue and |
The problem also occur when a file under the src is symbolic link to a typescript file outside the project. e.g. the file structure as below:
when I compile the project at myapp/myapp-app,
with the word |
My workaround is to use pre/post hook in npm script to unlink and link the files ... |
seems to be the same as other resolved issues
So based on the details mentioned here, this looks to be the same as #216 . While that one came later and describes the problem a bit differently, it also had a reproduction and stated the problem more directly. I was able to root cause both that issue and its rough duplicate, #295 , as well as fix both by upgrading rpt2 to latest. solution is to upgrade to rpt2 v0.30+ (ideally latest)Per #216 (comment) and #295 (comment), this was resolved in rpt2 So if you upgrade to rpt2 0.30+ (ideally just use latest), you should be able to transpile files outside of the package root. alternative solutionsIn older versions of rpt2, changing the
Using |
When symlink is created to the dependency, rollup is giving error
Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)
Environment
Versions
rollup.config.js
tsconfig.json
package.json
plugin output with verbosity 3
The text was updated successfully, but these errors were encountered: