Ajaxmin MinifyJavascript adding before object
I am facing an issue while minifying a javascript file using AjaxMin's MinifyJavaScript method.
Unminified Code
if (typeof define === 'function' && define.amd)
define(['moment'], function (moment)
root.moment = factory(moment)
return root.moment
)
else if (typeof exports === 'object')
module.exports = factory(require('moment'))
else
root.moment = factory(root.moment)
Minified Code
if(typeof define=="function"&&define.amd)define(["moment"],function(i)return n.moment=t(i),n.moment);else if(typeof exports=="object")module.exports=t(require("moment"))else n.moment=t(n.moment)}
Here in minified code "" is added after module object e.g.: module.exports but it should be module.exports
There are few more files before minifying the file:
1. jquery-3.3.1.min.js
2. moment.min.js
All the files are bundled in single file and after that minification is done.
javascript microsoft-ajax-minifier ajaxmin
|
show 3 more comments
I am facing an issue while minifying a javascript file using AjaxMin's MinifyJavaScript method.
Unminified Code
if (typeof define === 'function' && define.amd)
define(['moment'], function (moment)
root.moment = factory(moment)
return root.moment
)
else if (typeof exports === 'object')
module.exports = factory(require('moment'))
else
root.moment = factory(root.moment)
Minified Code
if(typeof define=="function"&&define.amd)define(["moment"],function(i)return n.moment=t(i),n.moment);else if(typeof exports=="object")module.exports=t(require("moment"))else n.moment=t(n.moment)}
Here in minified code "" is added after module object e.g.: module.exports but it should be module.exports
There are few more files before minifying the file:
1. jquery-3.3.1.min.js
2. moment.min.js
All the files are bundled in single file and after that minification is done.
javascript microsoft-ajax-minifier ajaxmin
C#
tag looks like a misplaced tag here...
– elgonzo
Nov 13 '18 at 10:57
You need to put some;
in your code. The carriage returns are signifying the end of your lines, once you remove these and without any;
your minified code does something very different.
– Liam
Nov 13 '18 at 10:59
I tried with ; also but it gives me same result
– Gaurav Mishra
Nov 13 '18 at 11:04
so what's your minified output now? Please edit the question.
– Liam
Nov 13 '18 at 11:31
The one mentioned above
– Gaurav Mishra
Nov 13 '18 at 11:32
|
show 3 more comments
I am facing an issue while minifying a javascript file using AjaxMin's MinifyJavaScript method.
Unminified Code
if (typeof define === 'function' && define.amd)
define(['moment'], function (moment)
root.moment = factory(moment)
return root.moment
)
else if (typeof exports === 'object')
module.exports = factory(require('moment'))
else
root.moment = factory(root.moment)
Minified Code
if(typeof define=="function"&&define.amd)define(["moment"],function(i)return n.moment=t(i),n.moment);else if(typeof exports=="object")module.exports=t(require("moment"))else n.moment=t(n.moment)}
Here in minified code "" is added after module object e.g.: module.exports but it should be module.exports
There are few more files before minifying the file:
1. jquery-3.3.1.min.js
2. moment.min.js
All the files are bundled in single file and after that minification is done.
javascript microsoft-ajax-minifier ajaxmin
I am facing an issue while minifying a javascript file using AjaxMin's MinifyJavaScript method.
Unminified Code
if (typeof define === 'function' && define.amd)
define(['moment'], function (moment)
root.moment = factory(moment)
return root.moment
)
else if (typeof exports === 'object')
module.exports = factory(require('moment'))
else
root.moment = factory(root.moment)
Minified Code
if(typeof define=="function"&&define.amd)define(["moment"],function(i)return n.moment=t(i),n.moment);else if(typeof exports=="object")module.exports=t(require("moment"))else n.moment=t(n.moment)}
Here in minified code "" is added after module object e.g.: module.exports but it should be module.exports
There are few more files before minifying the file:
1. jquery-3.3.1.min.js
2. moment.min.js
All the files are bundled in single file and after that minification is done.
javascript microsoft-ajax-minifier ajaxmin
javascript microsoft-ajax-minifier ajaxmin
edited Nov 13 '18 at 11:35
Gaurav Mishra
asked Nov 13 '18 at 10:55
Gaurav MishraGaurav Mishra
83
83
C#
tag looks like a misplaced tag here...
– elgonzo
Nov 13 '18 at 10:57
You need to put some;
in your code. The carriage returns are signifying the end of your lines, once you remove these and without any;
your minified code does something very different.
– Liam
Nov 13 '18 at 10:59
I tried with ; also but it gives me same result
– Gaurav Mishra
Nov 13 '18 at 11:04
so what's your minified output now? Please edit the question.
– Liam
Nov 13 '18 at 11:31
The one mentioned above
– Gaurav Mishra
Nov 13 '18 at 11:32
|
show 3 more comments
C#
tag looks like a misplaced tag here...
– elgonzo
Nov 13 '18 at 10:57
You need to put some;
in your code. The carriage returns are signifying the end of your lines, once you remove these and without any;
your minified code does something very different.
– Liam
Nov 13 '18 at 10:59
I tried with ; also but it gives me same result
– Gaurav Mishra
Nov 13 '18 at 11:04
so what's your minified output now? Please edit the question.
– Liam
Nov 13 '18 at 11:31
The one mentioned above
– Gaurav Mishra
Nov 13 '18 at 11:32
C#
tag looks like a misplaced tag here...– elgonzo
Nov 13 '18 at 10:57
C#
tag looks like a misplaced tag here...– elgonzo
Nov 13 '18 at 10:57
You need to put some
;
in your code. The carriage returns are signifying the end of your lines, once you remove these and without any ;
your minified code does something very different.– Liam
Nov 13 '18 at 10:59
You need to put some
;
in your code. The carriage returns are signifying the end of your lines, once you remove these and without any ;
your minified code does something very different.– Liam
Nov 13 '18 at 10:59
I tried with ; also but it gives me same result
– Gaurav Mishra
Nov 13 '18 at 11:04
I tried with ; also but it gives me same result
– Gaurav Mishra
Nov 13 '18 at 11:04
so what's your minified output now? Please edit the question.
– Liam
Nov 13 '18 at 11:31
so what's your minified output now? Please edit the question.
– Liam
Nov 13 '18 at 11:31
The one mentioned above
– Gaurav Mishra
Nov 13 '18 at 11:32
The one mentioned above
– Gaurav Mishra
Nov 13 '18 at 11:32
|
show 3 more comments
1 Answer
1
active
oldest
votes
I think this are the causes to the problem
ajaxmin source code module seems to be a reserved word- If/else scopes doesn't compiles properly to the output.
This seems to causing the issue
var blockType = AjaxMin.BlockTypeModule.FormatInvariant
(moduleScope.ScopeName.IfNullOrWhiteSpace(AjaxMin.ModuleNameImplicit));
Workaround (this is what I did in my project):
- You can replace that string
module.
withmodule.
- use ternary operator instead of if/else (most probably this will skip the replacement of that whole chunk)
- use minify version of that file (this will skip the minify)
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53279453%2fajaxmin-minifyjavascript-adding-before-object%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I think this are the causes to the problem
ajaxmin source code module seems to be a reserved word- If/else scopes doesn't compiles properly to the output.
This seems to causing the issue
var blockType = AjaxMin.BlockTypeModule.FormatInvariant
(moduleScope.ScopeName.IfNullOrWhiteSpace(AjaxMin.ModuleNameImplicit));
Workaround (this is what I did in my project):
- You can replace that string
module.
withmodule.
- use ternary operator instead of if/else (most probably this will skip the replacement of that whole chunk)
- use minify version of that file (this will skip the minify)
add a comment |
I think this are the causes to the problem
ajaxmin source code module seems to be a reserved word- If/else scopes doesn't compiles properly to the output.
This seems to causing the issue
var blockType = AjaxMin.BlockTypeModule.FormatInvariant
(moduleScope.ScopeName.IfNullOrWhiteSpace(AjaxMin.ModuleNameImplicit));
Workaround (this is what I did in my project):
- You can replace that string
module.
withmodule.
- use ternary operator instead of if/else (most probably this will skip the replacement of that whole chunk)
- use minify version of that file (this will skip the minify)
add a comment |
I think this are the causes to the problem
ajaxmin source code module seems to be a reserved word- If/else scopes doesn't compiles properly to the output.
This seems to causing the issue
var blockType = AjaxMin.BlockTypeModule.FormatInvariant
(moduleScope.ScopeName.IfNullOrWhiteSpace(AjaxMin.ModuleNameImplicit));
Workaround (this is what I did in my project):
- You can replace that string
module.
withmodule.
- use ternary operator instead of if/else (most probably this will skip the replacement of that whole chunk)
- use minify version of that file (this will skip the minify)
I think this are the causes to the problem
ajaxmin source code module seems to be a reserved word- If/else scopes doesn't compiles properly to the output.
This seems to causing the issue
var blockType = AjaxMin.BlockTypeModule.FormatInvariant
(moduleScope.ScopeName.IfNullOrWhiteSpace(AjaxMin.ModuleNameImplicit));
Workaround (this is what I did in my project):
- You can replace that string
module.
withmodule.
- use ternary operator instead of if/else (most probably this will skip the replacement of that whole chunk)
- use minify version of that file (this will skip the minify)
answered Nov 15 '18 at 7:01
Just codeJust code
10.4k53066
10.4k53066
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53279453%2fajaxmin-minifyjavascript-adding-before-object%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
C#
tag looks like a misplaced tag here...– elgonzo
Nov 13 '18 at 10:57
You need to put some
;
in your code. The carriage returns are signifying the end of your lines, once you remove these and without any;
your minified code does something very different.– Liam
Nov 13 '18 at 10:59
I tried with ; also but it gives me same result
– Gaurav Mishra
Nov 13 '18 at 11:04
so what's your minified output now? Please edit the question.
– Liam
Nov 13 '18 at 11:31
The one mentioned above
– Gaurav Mishra
Nov 13 '18 at 11:32