1
0
Fork 0
management/front/dkha-web-sz-main/node_modules/svg-sprite-loader/lib/utils/generate-import.js

17 lines
470 B
JavaScript
Raw Normal View History

2023-12-18 13:12:25 +08:00
const loaderDefaults = require('../config').loader;
const stringify = require('./stringify');
/**
* @param {string} symbol - Symbol name
* @param {string} module - Module name
* @param {boolean} esModule
* @return {string}
*/
function generateImport(symbol, module, esModule = loaderDefaults.esModule) {
return esModule ?
`import ${symbol} from ${stringify(module)}` :
`var ${symbol} = require(${stringify(module)})`;
}
module.exports = generateImport;