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

Incompatible with webpack #59

Closed
morgante opened this issue Nov 20, 2015 · 12 comments
Closed

Incompatible with webpack #59

morgante opened this issue Nov 20, 2015 · 12 comments

Comments

@morgante
Copy link

Due to the way in which AMD is tested for in validate.js, this module is incompatible with webpack. When built in a webpack environment, it causes this error:

define cannot be used indirect

I suggest switching to a more standard module test, such as UMD.

@kpalmvik
Copy link

Temporary workaround in webpack.config.js using string-replace-webpack-plugin, inspired by webpack/webpack#138 (comment)

var StringReplacePlugin = require('string-replace-webpack-plugin');
...
      test: /validate.js$/,
      include: /node_modules\/json-schema/,
      loader: StringReplacePlugin.replace({ // from the 'string-replace-webpack-plugin'
        replacements: [{
          pattern: /\(\{define:typeof define!="undefined"\?define:function\(deps, factory\)\{module\.exports = factory\(\);\}\}\)\./ig,
          replacement: function(match, p1, offset, string) {
            return false;
          }
        }]
      })
...
plugins: [
    ...
    new StringReplacePlugin()
  ],

@dukedougal
Copy link

Just spent three hours tracking this exact problem down. Webpack is widely used it would be great if this code supported it straight out of the box.

jsprim and ms-rest-azure are also broken due to this dependency

TritonDataCenter/node-jsprim#13

Any chance this can be fixed? It's a showstopper for using other packages. thanks

@dukedougal
Copy link

The outcome is still that Azure is broken with Webpack.

Azure say its not their problem, Webpack seem to think everyone else needs to make their packages compatible with it instead of the other way around, and the guy behind the json-schema package appears to have no interest in making his package to work with webpack.

It's a mexican standoff in which no-one wants to do what it takes to make their software work with each other.

Azure/autorest#734
webpack/webpack#2101

What can be done?

@nolanlawson
Copy link

lol, this is affecting us in PouchDB too (pouchdb/pouchdb#5312). Is it still a Mexican standoff if there are four of us? 😛

@rafaelcorreiapoli
Copy link

I'm also having this problem... any work around ?

@ForsakenHarmony
Copy link

still same issue

@ForsakenHarmony
Copy link

could you also release it, and not just fix it?

@dukedougal
Copy link

@ForsakenHarmony why so many big name packages depend on json-schema
which has very spotty support is a real question. It seems they would be well advised to replace it or fork it.

@ForsakenHarmony
Copy link

ask them, not me

@obecny
Copy link

obecny commented Sep 12, 2016

please release the fix

@kriszyp
Copy link
Owner

kriszyp commented Sep 12, 2016

Pushed a tag and npm publish.

@elyobo
Copy link

elyobo commented Jan 3, 2017

Close issue? Seems fine now.

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

9 participants