Skip to content
This repository was archived by the owner on Sep 6, 2022. It is now read-only.
This repository was archived by the owner on Sep 6, 2022. It is now read-only.

Could not load asc:{path to file}/file.as #2

Closed
@ghost

Description

I'm super excited to try out assemblyscript in a project. thanks for building this plugin!

when i used this plugin to try the add example, I keep getting:

[!] (plugin assemblyscript) Error: Could not load asc:/correct/path/to/file/file.as (imported by file/using/this/import/service.js)

In the file.as I have

export function add(a: i32, b: i32): i32 {
  return a + b;
}

in the service.js i have:

import {instancePromise} from 'asc:./file.as';
class Service{
  ...
  async doAdd(a, b) {
    const instance = await instancePromise;
    return instance.exports.add(a, b);
  }
}

The only thing that I'm not sure about is that I'm using @open-wc's rollup config, so my rollup config looks like:

import {createSpaConfig} from '@open-wc/building-rollup';
import gzipPlugin from 'rollup-plugin-gzip'
import { asc } from "rollup-plugin-assemblyscript";

const config = createSpaConfig({ legacyBuild: false, injectServiceWorker: false });

export default {
  ...config,
  input: './src/index.html',
  plugins: [
    asc(),
    ...config.plugins,
    gzipPlugin({
      filter: /\.(js|mjs|json|css)$/
    }),
  ],
}

I guess my main question is, am I missing something obvious on the plugin side of things?

Once again, thank you for building the plugin!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions