Giter Site home page Giter Site logo

jsccify's People

Contributors

amarcruz avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

jsccify's Issues

Interferes with transpilation

I found a problem trying to put a debug logging function in a separate module using ES6 modules:

Source "main.js":

//#if _DEBUG
//#set _LOG 'debugout'
import {$_LOG} from './mymodule'
//#else
//#set _LOG '//'
//#endif

$_LOG('Oops!')

Source "mymodule.js":

/*#if _DEBUG
export function debugout (s) {
  console.log(s)
}
//#elif 0 // */
export const $_LOG = null
//#endif

In all other submodules (imported from main.js) I could then shorten the boilerplate to the following since _LOG has already been set through main.js. I think there's no easy solution to get rid of the if condition since it is part of the import clause:

//#if _DEBUG
import {$_LOG} from './mymodule'
//#endif

After running browserify without jsccify:

mymodule.$_LOG('Oops!');

After running browserify with jsccify and _DEBUG = 0:

mymodule.//('Oops!');

This is the problem. It seems to apply jscc a bit too late.

After running browserify with jsccify and _DEBUG = 1:

mymodule.debugout('Oops!');

But now it is complaining that debugout is not defined in the other module which probably means that some processing order is not right.

Note that the same is working with the rollup plugin.

I use -t jsccify -p tsify as browserify options. The tsify is for TypeScript transpilation but I guess the same would happen with any kind of transpilation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.