Skip to content Skip to sidebar Skip to footer

How To Use Google-closure-compiler-js For A Node.js App Without Gulp/grunt/webpack?

The docs don't have any examples of using this on its own but they do say this: Unless you're using the Gulp or Webpack plugins, you'll need to specify code via flags. Both jsCode

Solution 1:

Borrowing from icidasset/quotes.

It appears, to me, that path is not intended to be used as you are using it.

Quote:

Using path, you can construct a virtual filesystem for use with ES6 or CommonJS imports—although for CommonJS, be sure to set processCommonJsModules: true.

So instead you must expand your own sources, something webpack and gulp must be doing for you when you go that route.

files=['./server/server.js']
files.map(f => {
    constout = compile({
      jsCode: [{ src: f.content }],
      assumeFunctionWrapper: true,
      languageIn: 'ECMASCRIPT5'
    });
    returnout;
}

Post a Comment for "How To Use Google-closure-compiler-js For A Node.js App Without Gulp/grunt/webpack?"