dom-script-loader
v7.7.777
Published
`npm install --save-dev dom-script-loader`
Downloads
44
Readme
Install
npm install --save-dev dom-script-loader
Or
yarn add --dev dom-script-loader
Desc
Load javascript. Fix for someone js module (like: fuck fuck fuck fuck fuck fuck datatables in vue's webpack)
#Example
sample project tree like:
- node_modules
- static
- js
- list.txt
- some-file.js
- ...
- js
- some-dir
- some-dir
- some-file.js
- some-module-need-jquery.js
- ...
- some-dir
- package.json
- ...
// use path
require('dom-script-loader?uri=static/js/some-file.js!');
require('dom-script-loader?uri=some-dir/some-dir/some-file.js!');
// or use link
require('dom-script-loader?uri=https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js!');
// or queue load use "|"
require('dom-script-loader?uri=https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js|some-dir/some-dir/some-module-need-jquery.js!');
// or queue load use list
require('dom-script-loader?list=static/js/list.txt!');
// or queue load use bold ("|" is always load first)
require('dom-script-loader?list=static/js/list.txt&uri=https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js|some-dir/some-dir/some-module-need-jquery.js!');
// if error build add ./path/to/empty.js (any exists file path) after !
// ex:
require('dom-script-loader?list=static/js/list.txt!./path/to/empty.js');
static/js/list.txt sample
https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
some-dir/some-dir/some-module-need-jquery.js
...