Apache Cordova - 从 JS 文件导入 JS 文件

Apache Cordova - Importing JS file from JS file

你好 Stack 社区,

我想从另一个 JS 文件导入一个 JS 文件。

我试过像这样导入:

主文件:

import { test } from 'secondary.js' // and without {}

test();

副档

export function test(){
    alert(1);
}

我用花括号得到了什么

而且没有...

并尝试导出模块

module.exports.test = () => {
alert(1);
}

也尝试过:

const { test } = require('secondary.js');

已解决,集成Ionic时,可以设置导入ES6文件