Skip to content

unable to import from installed library in node_modules without relative path #1954

Description

@trusktr

#1679 got closed by the super ugly stupid stale bot (:robot::boom:• • • • :boom::gun:), so continuing here:

I just tried this on 0.19.5 and I still get an error:

import {...} from 'asdom/assembly/index'
> asc assembly/index.ts --target debug --exportRuntime --exportTable

ERROR TS6054: File '~lib/asdom/assembly/index.ts' not found.

 } from 'asdom/assembly/index'
        ~~~~~~~~~~~~~~~~~~~~~~
 in assembly/index.ts(9,8)

FAILURE 1 parse error(s)

This works though:

import {...} from '../node_modules/asdom/assembly/index'

Reproduction:

git clone https://github.com/lume/asdom.git
cd asdom
git checkout unable-to-import
npm install
cd example
npm install
npm run dev // ERROR

The following works, but TypeScript shows red squigglies and intellisense breaks because AssemblyScript projects are not set up by default to satisfy TypeScript node resolution:

import {...} from 'asdom' // red squigglies all over!

The following doesn't work in AS, but it is proper and TypeScript will see the correct imports and we will get working intellisense:

import {...} from 'asdom/assembly/index' // Intellisense works, but not AS

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions