Coder Social home page Coder Social logo

ember-cli-cjs-transform's Introduction

ember-cli-cjs-transform

This addon allows importing files that are in the CommonJS format via the standard app.import functionality added in ember-cli 2.16.

Installing

ember install ember-cli-cjs-transform

Usage

In your ember-cli-build.js file just like the amd transform!

For example, add the following to import some-name's index.js into your build:

app.import('node_modules/some-name/index.js', {
  using: [
    { transformation: 'cjs', as: 'some-name' }
  ]
});

At build time we automatically follow all dependencies (e.g. internal require calls) in the source file, and includes their contents in the final build output.

This means that even for reasonably complicated things, we can app.import the "entry point" files and everything "just" works.

Examples (used while testing functionality):

Bringing in showdown and showdown-highlight for usage (without extra "shim" addon packages!):

app.import('node_modules/showdown/dist/showdown.js', {
  using: [{ transformation: 'cjs', as: 'showdown' }]
});
app.import('node_modules/showdown-highlight/lib/index.js', {
  using: [{ transformation: 'cjs', as: 'showdown-highlight' }]
});
app.import('node_modules/highlight.js/styles/tomorrow-night.css');

There may be cases where you need additional rollup plugins in order to import your CommonJs files. For example, you may need to handle builtin node require statements, i.e.

var path = require('path');

For this, you may want to import the rollup plugin rollup-plugin-node-builtins. In order to do this, include the plugin in your package.json and use the following syntax in your ember-cli-build.js or index.js:

const nodeBuiltins = require('rollup-plugin-node-builtins');

app.import('node_modules/some-name/index.js', {
  using: [
    { transformation: 'cjs', as: 'some-name', plugins: [ nodeBuiltins() ]}
  ]
});

You can include multiple rollup plugins in the array and pass in options via the arguments to your plugin creation function.

app.import('node_modules/some-name/index.js', {
  using: [
    {
      transformation: 'cjs',
      as: 'some-name',
      plugins: [
        plugin1(),
        plugin2({ option1: "value" })
      ]
    }
  ]
});

Contributing

Installation

  • git clone <repository-url> this repository
  • cd ember-cli-cjs-transform
  • yarn install

Running

Running Tests

  • yarn test (Runs ember try:each to test your addon against multiple Ember versions)
  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit https://ember-cli.com/.

ember-cli-cjs-transform's People

Contributors

acorncom avatar cafreeman avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar ember-tomster avatar eturino avatar gaurav0 avatar rwjblue avatar stefanpenner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ember-cli-cjs-transform's Issues

Resolving sub-dependencies fails for some packages

For some npm packages (I have not yet figured out why) the build fails when it tries to resolve transitive dependencies. This happens for example with googleapis.

Here is my ember-cli-build.js:

app.import('node_modules/googleapis/build/src/index.js', {
  using: [{ transformation: 'cjs', as: 'googleapis' }],
});

Here is the error output:



Unexpected token

...
'fs' is imported by node_modules/google-auth-library/build/src/auth/googleauth.js, but could not be resolved – treating it as an external dependency
'fs' is imported by commonjs-external:fs, but could not be resolved – treating it as an external dependency
'url' is imported by commonjs-external:url, but could not be resolved – treating it as an external dependency
'util' is imported by node_modules/lru-cache/index.js, but could not be resolved – treating it as an external dependency
'util' is imported by node_modules/google-auth-library/build/src/auth/googleauth.js, but could not be resolved – treating it as an external dependency
'util' is imported by commonjs-external:util, but could not be resolved – treating it as an external dependency
'stream' is imported by node_modules/google-auth-library/build/src/auth/oauth2client.js, but could not be resolved – treating it as an external dependency
'stream' is imported by commonjs-external:stream, but could not be resolved – treating it as an external dependency
'stream' is imported by node_modules/jws/lib/sign-stream.js, but could not be resolved – treating it as an external dependency
'stream' is imported by node_modules/jws/lib/verify-stream.js, but could not be resolved – treating it as an external dependency
'stream' is imported by node_modules/jws/lib/data-stream.js, but could not be resolved – treating it as an external dependency
'util' is imported by node_modules/jws/lib/sign-stream.js, but could not be resolved – treating it as an external dependency
'util' is imported by node_modules/jws/lib/verify-stream.js, but could not be resolved – treating it as an external dependency
'util' is imported by node_modules/jws/lib/data-stream.js, but could not be resolved – treating it as an external dependency
'fs' is imported by node_modules/gtoken/build/src/index.js, but could not be resolved – treating it as an external dependency
...
and some more...

Seems to inflate build a lot

I am using this to pull in showdown-highlight and my build size goes from 245 kb to 415 kb. That seems like an awful lot for pulling in one package. Perhaps we are pulling in extra things accidentally here?

`cjs-transform` cache files in `$TMPDIR` require removal to avoid import errors

Hi,

Periodically, we've been seeing an issue occur when running ember s locally in our project. The app will not load because of a fatal error "Could not find module ember-resolver". After some quick investigation, we discovered that if we remove the cjs-transform temporary cache directory, it fixes the problem:

$ find $TMPDIR -type d -name '*cjs-transform*' -exec rm -rf {} +;

ember-cli version: 2.16.2
ember-cli-cjs-transform version: 1.3.0
ember-resolver version: 4.5.5

Security vulnerability warning from incorrectly deployed npm package

Now that github has automated security warnings, a project I work on keeps getting pinged about mem and changing to mem@^4.0.0:

tracing it comes from this project, via the username dependency. My first step was to update to the latest ember-cli-cjs-transform (1.3.1), however this didn't fix it, as it was still using username ^3.0.0

I thought this was very odd, as looking at this project's package.json and yarn.lock for 1.3.1 it seems it should be username ^4.0.0

so I started to dive in more, I tried a few things (clearing yarn cache, removing yarn.lock, etc) but nothing worked. Eventually I thought maybe the yarn pkg is wrong. So I downloaded the resolved package and to my surprise it had a package.json with username ^3.0.0

I then tried a brand new project with npm only, and was surprised to see the same thing in the package-lock. This has led me to believe the currently deployed npm package for 1.3.1 is not matching the code at 1.3.1

win32 rollup bug: `dependencies` of an app.import are not creating a corresponding cjs browser module

This is a meta issue that is probably best filed upstream at https://github.com/rollup/rollup-plugin-commonjs or https://github.com/rollup/rollup-plugin-node-resolve - the closest related issue is rollup/rollup-plugin-commonjs#177 but I can better explain the issue here, in the context in which I experienced and debugged it, in hopes that someone with more rollup context might know where best to resolve the root cause.

Repro:

I don't have a sample app, in fact, our team decided to use bash for windows, so this was a one day issue, I then moved my windows vm to a backup drive, then felt I should report this b/c it's not fully reported anywhere else in rollup land and it would require a lot of digging to fix if the windows users im
working with weren't so open to using bash, so for future travelers, herego:

  • open a windows shell, this bug does not exist on posix based shells
  • generate an empty ember app
  • install this addon ember install ember-cli-cjs-transform
  • Install a node module that has a dep that would need resolving/rolling up - very easy example is: yarn add @material/top-app-bar -D or npm i @material/top-app-bar -D, they both produce same behavior. Yarn 1.7, npm 6. Node 8.
  • in ember-cli-build add the following:
  app.import(`node_modules/@material/top-app-bar/index.js`, {
    using: [{
      transformation: 'cjs',
      as: `@material/top-app-bar`
    }]
  });
  • generate a component ember g component blah
  • import the dep inside the component: import { MDCTopAppBar } from '@material/top-app-bar';
  • run ember s

You'll see a number of console messages, all of the form /foo/bar/baz ... requires ... \dep-a\bar\baz ...but could not be resolved – treating it as an external dependency.

for each output ...treating it as an external dependency, there is a corresponding dependency in the original package.json for the app.import posix formatted path provided - eg: app.import(node_modules/@material/top-app-bar/index.js, {

  "dependencies": {
    "@material/animation": "^0.34.0",
    "@material/base": "^0.35.0",
    "@material/elevation": "^0.35.0",
    "@material/ripple": "^0.35.0",
    "@material/rtl": "^0.35.0",
    "@material/theme": "^0.35.0",
    "@material/typography": "^0.35.0"
  },

those each have their own deps too, so on, so forth, all will show output that a cjs module could not be found which is misleading, it wasn't built is the problem, question is why...

The best way to describe what I think the issue is, I found here rollup/rollup-plugin-commonjs#177 - aka


For example typescript's built-in resolver returns module paths using forward slashes, while commonjs takes output of resolve at face value. Since that happens to return system native path with backslashes (in ver 1.1.7 at least), mishaps can result depending on which plugin happened to resolve a given module first.

One way to fix it would be to normalize path before using it as a key.


Ignoring typescript and the version of rollup-plugin-commonjs, and noting that the console output actually comes from rollup-plugin-node-resolve, not rollup-plugin-commonjs,

commonjs takes output of resolve at face value

is the root cause i believe

actually finding the module on the file system doesn't seem to be the problem, its when the dep is found, its string is formatted wrong and no define IIFE is created

I personally will not likely follow up further, but before es6 modules in the browser become super popular, this at the very least provides a heads up that somewhere upstream this will have to be fixed for windows users in order for them to make a build locally

Add `es6` transform?

The logic is basically the same (we just wouldn't add rollup-plugin-commonjs)...

Did not get error that my relative path was not starting with node_modules

My path was vendor/edited/bugout/index.js. It took me a long time to figure out what went wrong, until I read the source of this library since I was guessing it reads out the node_modules folder. I did not get the error: The "cjs" transform works only with NPM packages.
You tried to use it with "${relativePath}". Make sure your imported file path
begins with "node_modules/".

This is my full output of the command ember serve --port 4444

Could not start watchman
Visit https://ember-cli.com/user-guide/#watchman for more info.
Cannot find module '.js' from '/Users/username/path_to_app'


Stack Trace and Error Report: /var/folders/_4/xkxbjb2x1173s0mpwmxcqkkh0000gn/T/error.dump.e7c384ff0fbccc21ee4b04b0ced69e44.log

The stack trace and error report also didn't show it.

Transformation addon does not respect `resolveFrom` option passed to `app.import`

Problem

Tested in ember-cli 2.18.2 and 3.3.0

The AMD transform allows users to specify an optional resolveFrom. This allows addons to call app.import and reference their dependencies instead of resolving all node modules relative to the app.

// In file `/path/to/app/node_modules/addon-name/index.js`

// Resolves to `/path/to/app/node_modules/path/to/thing.js` 
app.import("node_modules/path/to/thing.js",{
  using: [{ transformation: 'cjs', as: 'asset-name' }],
});

// Resolves to `/path/to/app/node_modules/addon-name/node_modules/path/to/thing.js` 
app.import("node_modules/path/to/thing.js",{
  using: [{ transformation: 'cjs', as: 'asset-name' }],
  resolveFrom: __dirname,
});

The CJS transform attempts to resolve the file on disk here and here. However, the resolveFrom option is never passed – it always tries to resolve from parent.root.

This results in an error when the CJS transform can't find the module.

Potential Fixes

It doesn't appear that ember-cli passes the resolveFrom option to the custom transforms. If we want to enable this use case without changes to ember-cli, the option will need to be passed twice in userland:

// Duplicate options, but minimal changes and easier rollout
app.import("node_modules/path/to/thing.js",{
  using: [{ transformation: 'cjs', as: 'asset-name', resolveFrom: __dirname }],
  resolveFrom: __dirname,
});

Otherwise, the resolveFrom option can be passed along to custom transforms' processOptions hook to be made available for use: https://github.com/ember-cli/ember-cli/blob/v3.0.x/lib/broccoli/ember-app.js#L1711

Let me know if I'm off base here! Happy to help make these changes if you'd like to move forward with a fix.

addon bundling + npm linking has problems

I think it is broken because of the assumption:

input: path.posix.join(this.projectRoot, relativePath),

app.import('node_modules/blah' no longer works because of deep nesting, and app.import(require.resolve('blah') doesn't work because of the projectRoot join mangling two absolute paths.

Babel transpilation

This might be the wrong repo to ask this, but I'm not sure where else it would fit better: how can we handle CJS modules that were written for e.g. Node 8 and will require transpilation when being run in e.g. IE11?

CJS Transform - Unexpected token: /ember-cli-cjs-transform/node_modules/rollup/dist/rollup.js:199:15

Having similar issue to this but have imported rollup-plugin-node-builtins module as described in the readme.

ember-cli-build.js looks like this:

  const nodeBuiltins = require('rollup-plugin-node-builtins');
  app.import('node_modules/googleapis/build/src/index.js', {
    using: [
      { transformation: 'cjs', as: 'googleapis', plugins: [ nodeBuiltins() ] }
    ]
  });

Full stack trace:

=================================================================================

ENV Summary:

  TIME: Tue Jul 23 2019 04:28:49 GMT-0700 (Pacific Daylight Time)
  TITLE: ember
  ARGV:
  - /usr/local/Cellar/node/12.5.0/bin/node
  - /usr/local/Cellar/node/12.5.0/bin/ember
  - s
  EXEC_PATH: /usr/local/Cellar/node/12.5.0/bin/node
  TMPDIR: /var/folders/m3/_vjwm8gx1kz67xbq5w4vgk_000048w/T
  SHELL: /bin/zsh
  PATH:
  - /usr/local/Cellar/node/12.5.0/bin
  - /usr/local/Cellar/node/11.14.0/bin
  - /Users/michaelchen/.yarn/bin
  - /Users/michaelchen/bin
  - /usr/local/sbin
  - /usr/local/bin
  - /usr/bin
  - /bin
  - /usr/sbin
  - /sbin
  - /opt/local/bin
  ... (Python, etc.)
  PLATFORM: darwin x64
  FREEMEM: 36102144
  TOTALMEM: 17179869184
  UPTIME: 3345448
  LOADAVG: 6.83544921875,4.68798828125,5.5068359375
  CPUS:
  - Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz - 2500
  - Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz - 2500
  - Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz - 2500
  - Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz - 2500
  - Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz - 2500
  - Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz - 2500
  - Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz - 2500
  - Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz - 2500
  ENDIANNESS: LE
  VERSIONS:
  - ares: 1.15.0
  - brotli: 1.0.7
  - cldr: 35.1
  - http_parser: 2.8.0
  - icu: 64.2
  - modules: 64
  - napi: 4
  - nghttp2: 1.34.0
  - node: 10.16.0
  - openssl: 1.1.1b
  - tz: 2019a
  - unicode: 12.1
  - uv: 1.28.0
  - v8: 6.8.275.32-node.52
  - zlib: 1.2.11

ERROR Summary:

  - broccoliBuilderErrorStack: Error: Unexpected token
    at error (/Users/michaelchen/Development/misc-dev/dummy-chrome-extension/timeline-project/node_modules/ember-cli-cjs-transform/node_modules/rollup/dist/rollup.js:199:15)
    at Module.error (/Users/michaelchen/Development/misc-dev/dummy-chrome-extension/timeline-project/node_modules/ember-cli-cjs-transform/node_modules/rollup/dist/rollup.js:17170:9)
    at tryParse (/Users/michaelchen/Development/misc-dev/dummy-chrome-extension/timeline-project/node_modules/ember-cli-cjs-transform/node_modules/rollup/dist/rollup.js:16845:16)
    at Module.setSource (/Users/michaelchen/Development/misc-dev/dummy-chrome-extension/timeline-project/node_modules/ember-cli-cjs-transform/node_modules/rollup/dist/rollup.js:16910:33)
    at /Users/michaelchen/Development/misc-dev/dummy-chrome-extension/timeline-project/node_modules/ember-cli-cjs-transform/node_modules/rollup/dist/rollup.js:20699:20
  - code: [undefined]
  - codeFrame: Unexpected token
  - errorMessage: Unexpected token
        at CJSTransform (CJS Transform)
-~- created here: -~-
    at new Plugin (/Users/michaelchen/Development/misc-dev/dummy-chrome-extension/timeline-project/node_modules/broccoli-plugin/index.js:7:31)
    at new CJSTransform (/Users/michaelchen/Development/misc-dev/dummy-chrome-extension/timeline-project/node_modules/ember-cli-cjs-transform/src/cjs-transform.js:14:5)
    at Object.transform [as callback] (/Users/michaelchen/Development/misc-dev/dummy-chrome-extension/timeline-project/node_modules/ember-cli-cjs-transform/src/index.js:18:27)
    at DefaultPackager.applyCustomTransforms (/Users/michaelchen/Development/misc-dev/dummy-chrome-extension/timeline-project/node_modules/ember-cli/lib/broccoli/default-packager.js:334:57)
    at DefaultPackager.processAppAndDependencies (/Users/michaelchen/Development/misc-dev/dummy-chrome-extension/timeline-project/node_modules/ember-cli/lib/broccoli/default-packager.js:249:27)
    at DefaultPackager.packageJavascript (/Users/michaelchen/Development/misc-dev/dummy-chrome-extension/timeline-project/node_modules/ember-cli/lib/broccoli/default-packager.js:1296:32)
    at EmberApp._legacyPackage (/Users/michaelchen/Development/misc-dev/dummy-chrome-extension/timeline-project/node_modules/ember-cli/lib/broccoli/ember-app.js:1773:48)
    at EmberApp.toTree (/Users/michaelchen/Development/misc-dev/dummy-chrome-extension/timeline-project/node_modules/ember-cli/lib/broccoli/ember-app.js:1819:27)
    at module.exports (/Users/michaelchen/Development/misc-dev/dummy-chrome-extension/timeline-project/ember-cli-build.js:42:14)
    at Builder.readBuildFile (/Users/michaelchen/Development/misc-dev/dummy-chrome-extension/timeline-project/node_modules/ember-cli/lib/models/builder.js:51:14)
-~- (end) -~-
  - errorType: Build Error
  - location:
    - column: [undefined]
    - file: [undefined]
    - line: [undefined]
    - treeDir: [undefined]
  - message: Unexpected token
        at CJSTransform (CJS Transform)
-~- created here: -~-
    at new Plugin (/Users/michaelchen/Development/misc-dev/dummy-chrome-extension/timeline-project/node_modules/broccoli-plugin/index.js:7:31)
    at new CJSTransform (/Users/michaelchen/Development/misc-dev/dummy-chrome-extension/timeline-project/node_modules/ember-cli-cjs-transform/src/cjs-transform.js:14:5)
    at Object.transform [as callback] (/Users/michaelchen/Development/misc-dev/dummy-chrome-extension/timeline-project/node_modules/ember-cli-cjs-transform/src/index.js:18:27)
    at DefaultPackager.applyCustomTransforms (/Users/michaelchen/Development/misc-dev/dummy-chrome-extension/timeline-project/node_modules/ember-cli/lib/broccoli/default-packager.js:334:57)
    at DefaultPackager.processAppAndDependencies (/Users/michaelchen/Development/misc-dev/dummy-chrome-extension/timeline-project/node_modules/ember-cli/lib/broccoli/default-packager.js:249:27)
    at DefaultPackager.packageJavascript (/Users/michaelchen/Development/misc-dev/dummy-chrome-extension/timeline-project/node_modules/ember-cli/lib/broccoli/default-packager.js:1296:32)
    at EmberApp._legacyPackage (/Users/michaelchen/Development/misc-dev/dummy-chrome-extension/timeline-project/node_modules/ember-cli/lib/broccoli/ember-app.js:1773:48)
    at EmberApp.toTree (/Users/michaelchen/Development/misc-dev/dummy-chrome-extension/timeline-project/node_modules/ember-cli/lib/broccoli/ember-app.js:1819:27)
    at module.exports (/Users/michaelchen/Development/misc-dev/dummy-chrome-extension/timeline-project/ember-cli-build.js:42:14)
    at Builder.readBuildFile (/Users/michaelchen/Development/misc-dev/dummy-chrome-extension/timeline-project/node_modules/ember-cli/lib/models/builder.js:51:14)
-~- (end) -~-
  - name: BuildError
  - nodeAnnotation: CJS Transform
  - nodeName: CJSTransform
  - originalErrorMessage: Unexpected token
  - stack: Error: Unexpected token
    at error (/Users/michaelchen/Development/misc-dev/dummy-chrome-extension/timeline-project/node_modules/ember-cli-cjs-transform/node_modules/rollup/dist/rollup.js:199:15)
    at Module.error (/Users/michaelchen/Development/misc-dev/dummy-chrome-extension/timeline-project/node_modules/ember-cli-cjs-transform/node_modules/rollup/dist/rollup.js:17170:9)
    at tryParse (/Users/michaelchen/Development/misc-dev/dummy-chrome-extension/timeline-project/node_modules/ember-cli-cjs-transform/node_modules/rollup/dist/rollup.js:16845:16)
    at Module.setSource (/Users/michaelchen/Development/misc-dev/dummy-chrome-extension/timeline-project/node_modules/ember-cli-cjs-transform/node_modules/rollup/dist/rollup.js:16910:33)
    at /Users/michaelchen/Development/misc-dev/dummy-chrome-extension/timeline-project/node_modules/ember-cli-cjs-transform/node_modules/rollup/dist/rollup.js:20699:20

=================================================================================

Seems to get tripped up on json files?

I was trying to import aws-iot-device-sdk. Building the ember app seemed to cause the cjs transform to break on the package.json file.

  // ember-cli-build.js
  app.import('node_modules/aws-iot-device-sdk/index.js', {
    using: [{ transformation: 'cjs', as: 'aws-iot-device-sdk' }]
  });
Build Error (CJSTransform) in .\node_modules\aws-iot-device-sdk\package.json:2:9

Unexpected token


Stack Trace and Error Report: error.dump.33b66b51326596af4144536855e8fd81.log
preferring built-in module 'events' over local alternative at '.\node_modules\events\events.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning

I'm using a Windows computer by the way in case that is important.

Intructions for addon bundling

I think it is

module.exports = {
  name: 'my-addon',

  importTransforms: require('ember-cli-cjs-transform').importTransforms
};

Change the latest version of this package on the npm registry

When performing npm outdated it is stated that version 1.3.1 is the latest:

➜  npm outdated
Package				Current		Wanted		Latest
ember-cli-cjs-transform		2.0.0		2.0.0		1.3.1

It is this way because the npm registry sees 1.3.1 as the latest version:

image

@rwjblue Is there anything we can do about it?

require is defined, causing an error, due to weird hacky browser/node compatibility

This line: https://github.com/dchest/tweetnacl-js/blob/master/nacl-fast.js#L2364

from ember-cli-build.js

  app.import('node_modules/tweetnacl/nacl-fast.js', {
    using: [
      { transformation: 'cjs', as: 'tweetnacl'}
    ]
  });

Error:

Error while processing route: login Could not find module `crypto` imported from `tweetnacl` Error: Could not find module `crypto` imported from `tweetnacl`

This is how I'm importing it:

import * as NaCl from 'tweetnacl';
console.log(NaCl);

commonJS module (pouchdb-authentication) not importing correctly

I am writing an addon for adding pouchdb-authentication to ember-simple-auth. I am attempting to import pouchdb-authentication as a CommonJS module.

I have done the following:

npm install --save pouchdb-authentication

In my index.js, I have added the following hook:

included(app){
  app.import('node_modules/pouchdb-authentication/lib/index.js', {
    using: [
      {transform: 'cjs', as: 'pouchdb-authentication'}
    ]
  }
}

When I attempt to use the module in a class, ie from PouchDBAuthentication import 'pouchdb-authentication, I get the following error:

Error: Could not find module `util` imported from `pouchdb-authentication`
at missingModule (http://localhost:7357/assets/vendor.js:252:11)
at findModule (http://localhost:7357/assets/vendor.js:263:7)
at Module.findDeps (http://localhost:7357/assets/vendor.js:173:24)
at findModule (http://localhost:7357/assets/vendor.js:267:11)
at Module.findDeps (http://localhost:7357/assets/vendor.js:173:24)
at findModule (http://localhost:7357/assets/vendor.js:267:11)
at requireModule (http://localhost:7357/assets/vendor.js:29:15)
at Class._extractDefaultExport (http://localhost:7357/assets/vendor.js:99921:20)
at Class.resolveOther (http://localhost:7357/assets/vendor.js:99621:32)
at Class.superWrapper [as resolveOther] (http://localhost:7357/assets/vendor.js:54195:22)

Any idea what is going on here? It does not look like util is an imported dependency in pouchdb-authentication.

js-xss not importing correctly

Importing dist/xss.js from js-xss produces a module whose default export is {}, rather than the filterXSS function. The module seems to be doing some kinda funny trickery with its exporting, so maybe this is out of scope of what ember-cli-cjs-transform is trying to support, but wanted to raise the issue just in case it's worth fixing.

Here is a sample project reproducing the issue.

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.