chrisprice/grunt-rollup

Output has null in place of define - any ideas?

Closed this issue · 2 comments

Hi, I can put together a fully reproducible example if it doesn't look like something someone has run into before.

I'm getting the following:

(function(global, factory) {
  typeof exports === 'object' && typeof module !== 'undefined' ?
      factory(exports) :
        typeof null === 'function' && null.amd ? null(['exports'], factory) :
          (global = typeof globalThis !== 'undefined' ?
              globalThis :
              global || self, factory(global.admin = {}));

When it should look like:

(function(global, factory) {
  typeof exports === 'object' && typeof module !== 'undefined' ?
      factory(exports) :
        typeof define === 'function' && define.amd ? define(['exports'], factory) :
          (global = typeof globalThis !== 'undefined' ?
              globalThis :
              global || self, factory(global.admin = {}));

For some reason I'm getting 'null' in place of 'define' and I really have no clue why that would be or where it's coming from.

Grunt task looks like:

rollup: {
  options: {
    plugins: [
      babel({
        exclude: 'node_modules/**',
        externalHelpers: true
      })
    ],
    format: 'umd',
    globals: {
      jquery: 'jQuery'
    },
    name: 'core'
  },
  files: {
    src: 'assets/src/admin/js/Core.js',
    dest: 'assets/dist/js/core.js'
  }
}

.babelrc

{
  "presets": [
    [
      "@babel/preset-env",
      {
        "loose": true,
        "modules": false
      }
    ]
  ],
  "plugins": [
    "@babel/plugin-external-helpers"
  ]
}

If I need to put together something else let me know... hoping someone knows right away what's up with this.

Ok, if this happens to anyone else I had to add:

amd: {
  define: 'define'
}

Even though I think define is supposed to be used by default and you're only supposed to have to use this option if you want to use your own define function.

Hi,

The problem has been tracked down and fixed. The fix will be shipped in the v11.4.0.

Sorry for the inconvenience.