[英]How can I import files into my front end main.js files?
I'm using wordpress, javascript and html我正在使用 wordpress、javascript 和 html
I am using wp_enqueue_script
我正在使用
wp_enqueue_script
Main.js includes, one hundred lines of code, so i want to break the code up into separate files. Main.js 包含一百行代码,所以我想将代码分解为单独的文件。
eg file 1, file 2, file 3.例如文件 1、文件 2、文件 3。
How can i import those files into the main.js file?如何将这些文件导入 main.js 文件?
I have tried using import, export statements but i get the error我曾尝试使用导入、导出语句,但出现错误
Cannot use import statement outside a module
try replacing import with require尝试用 require 替换 import
// import { parse } from 'node-html-parser';
const parse = require('node-html-parser');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.