Spectrum is now read-only. Learn more about the decision in our official announcement.


๐Ÿ“ฆ๐Ÿš€ Blazing fast, zero configuration web application bundler


Working on Kotlin transformer

August 20, 2019 at 10:00am

Working on Kotlin transformer

August 20, 2019 at 10:00am (Edited 3 years ago)
Hello everyone, I am working on Kotlin transformer for parcel v2, I have some questions:
  1. How should I import /kotlinc-js-api? using localRequire or add it as dependencies?
  2. Should I add "/local-require": "^2.0.0-alpha.1.1" to use localRequire?
  3. Who can I use fs from /fs? add it as dependencies? I am getting error TypeError: Cannot read property 'mkdirp' of undefined.
  4. How can I use path and os? import them directly or I need to add them as dependencies?
Thanks in advance!

August 20, 2019 at 12:05pm
  1. use localRequire, so that it gets installed in the users project
  2. take a look at other transformers e.g. sugarss:
export default new Transformer({
async transform({asset, localRequire}) {
const sugarss = await localRequire('sugarss', asset.filePath);
const code = await asset.getCode();
3 . use asset.fs inside the transform method 4 . just import them, they are node builtins and not npm packages