Skip to content
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

CJS modules with default exports do not work #92

Open
linker-err0r opened this issue Jul 30, 2018 · 1 comment
Open

CJS modules with default exports do not work #92

linker-err0r opened this issue Jul 30, 2018 · 1 comment

Comments

@linker-err0r
Copy link

linker-err0r commented Jul 30, 2018

I've tried a few of them, and so far, this class of modules seems to fail when it should be able to run in Screeps.

Consider this code added to main.ts in starter:

 // already in es6, of course
import { ErrorMapper } from "utils/ErrorMapper";

// this one works -- it's in es6 format
import * as _ from 'lodash-es'; 

 // uploads, but exports empty object
import * as _ from 'lodash';

// no error and these will upload, but code will fail on server without executing
import * as Chance from 'chance';
import * as faker from 'faker'; 

Please note that I have also taken the step of installing @types modules for these as well.

@resir014
Copy link
Member

resir014 commented Aug 1, 2018

Using CommonJS modules w/ Rollup will have to require some workarounds.

See: https://screepers.gitbook.io/screeps-typescript-starter/in-depth/module-bundling#note-rollup-and-named-exports

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants