Skip to content
This repository has been archived by the owner on May 23, 2022. It is now read-only.

Problem: arguments is a reserved word in strict mode #162

Open
hhkaos opened this issue Aug 10, 2020 · 2 comments
Open

Problem: arguments is a reserved word in strict mode #162

hhkaos opened this issue Aug 10, 2020 · 2 comments

Comments

@hhkaos
Copy link
Member

hhkaos commented Aug 10, 2020

Hi there!,

First of all, thanks for this awesome generator, I ❤️ it 😄.

I'm writing because the other day I had an issue developing a widget when I tried to use a third-party library within my widget.

When I copied the code of tinysoap-browser-min.js to a folder I noticed Grunt sent a message to the console:

Running "babel:main" (babel) task
Warning: widgets/CustomTinySoap/libs/tinysoap-browser-min.js: arguments is a reserved word in strict mode (499:50)

SInce the message showed up, grunt is not running the tasks after babel:main (copy and sync), and since then no modification made to any file triggers all tasks, which means that no file is being copied the server/apps/ID/widgets folder.

In the first place I tried to do a find & replace the word arguments within the tinysoap-browser, but that broke the code because it wasn't variable called arguments, it was using the argument object of JS.

Is there any way to bypass that warning message from babel task?

You can download the code of the widget I was using:
CustomTinySoap.zip

Thanks in advance!

@gavinr
Copy link
Contributor

gavinr commented Aug 10, 2020

It seems like the babel task does not like the contents of the tinySoap library. I think a workaround is to have the grunt task skip the two files in the libs directory and just copy over the file directly instead, like this:

Gruntfile.js:
image

Could you try this and see if it works for you?

@hhkaos
Copy link
Member Author

hhkaos commented Sep 10, 2020

Thank you Gavin and sorry for the delay!

It makes total sense what you're saying but for some reason (maybe I'm still asleep) it isn't working:

widgetSave

Any thoughts?

This is the code I used:

babel: {
            'options': { 'sourceMap': true },
            'main': {
                'files': [{
                        'expand': true,
                        'src': [
                            'widgets/*.js',
                            'widgets/**/*.js',
                            'widgets/**/**/*.js',
                            '!widgets/**/libs/**',
                            'widgets/!**/**/nls/*.js',
                            'themes/*.js',
                            'themes/**/*.js',
                            'themes/**/**/*.js',
                            'themes/!**/**/nls/*.js'
                        ],
                        'dest': 'dist/'
                    }]
            }
        }
        copy: {
            'main': {
                'src': [
                    'widgets/**/**.html',
                    'widgets/**/**.json',
                    'widgets/**/**.css',
                    'widgets/**/images/**',
                    'widgets/**/nls/**',
                    'widgets/**/libs/**',
                    'themes/**/**.html',
                    'themes/**/**.json',
                    'themes/**/**.css',
                    'themes/**/images/**',
                    'themes/**/nls/**',
                    'themes/**/layouts/**/*.*'
                ],
                'dest': 'dist/',
                'expand': true
            }
        },

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants