zxcvb5
June 11, 2020, 2:47am
1
For some reason, I want to add my jquery code to the end of jquery-min.js instead of using new separate file. My questions are:
Can my code conflict with jquery library code?
If somehow some browser does not execute my code (browser compatibility) will the code of jquery library work just ignoring my part of code?
I have to put my code into the jquery-min.js, there are no other options, so how to prevent future possible conflict, any ideas?
Thanks in advance for your answers
Are you sure? For instance, have you considered concatenating the scripts in a build step or use an actual module bundler such as webpack ?
Concatenating might be a simple cat
command (probably defined in the scripts
section of your package.json):
cat *.js >> my-jquery-build.js
Or with webpack you can define an array of scripts as entry point:
module.exports = {
entry: ['jquery.min.js', 'my-script.js'],
output: {
filename: 'my-jquery-build.js'
}
}
Other than that:
No more than including it separately
If you are using syntax older browsers don’t understand then yes, this will result in a parsing error and none of the code will be executed. Regular errors such as unsupported APIs shouldn’t be a problem though and can be caught
Use a build step as described above so you can keep jQuery itself separate and up-to-date
system
Closed
September 11, 2020, 12:59pm
4
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.