Code Monkey home page Code Monkey logo

Comments (5)

Fauntleroy avatar Fauntleroy commented on August 27, 2024

Full error stack

Uncaught TypeError: Cannot set property 'exports' of undefined scripts.js:9785
defineExport scripts.js:9785
browserifyShim scripts.js:9783
browserifyShim scripts.js:9785
require.en0Fjs scripts.js:9789
s scripts.js:1
(anonymous function) scripts.js:1
require../chat scripts.js:747
s scripts.js:1
e scripts.js:1
(anonymous function)

from grunt-browserify.

jmreidy avatar jmreidy commented on August 27, 2024

@shama, any thoughts on this? Thinking it's an issue with g-b's interface to grunt, since the file contents are exactly the same...

from grunt-browserify.

shama avatar shama commented on August 27, 2024

It looks like something isn't getting wrapped properly if module is undefined. I'm having trouble reproducing though. @Fauntleroy Could you post your example to a repo where we can download and test?

from grunt-browserify.

bywo avatar bywo commented on August 27, 2024

I'm running into the same issue. What I'm seeing is that shim'ed modules get wrapped n times by browserifyShim, where n is the index of file being compiled in files.

For example, if I have a browserify config like this:

files: {
  'a': ['a.js'],
  'b': ['b.js']
},
options: {
  shim: {
    'swfobject': {
      path: 'lib/swfobject.js',
      exports: 'swfobject'
    }
  },

and both "a" and "b" require('swfobject'):

"a"'s swfobject shim will work correctly:

var global = self;
(function browserifyShim(module, exports, define, browserify_shim__define__module__export__) {
...

but "b"'s swfobject will wrap the module two times:

var global = self;
(function browserifyShim(module, exports, define, browserify_shim__define__module__export__) {
    (function browserifyShim(module, exports, define, browserify_shim__define__module__export__) {
...

from grunt-browserify.

jmreidy avatar jmreidy commented on August 27, 2024

That makes sense then. shims is defined outside the forEachSeries processing of files; moving inside the iterator function should solve the problem, I think. I'll take a look this weekend.

from grunt-browserify.

Related Issues (20)

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.