简体   繁体   中英

Import old es5 file with webpack

I am trying to include a minified javascript file directly, it works perfectly fine but i do get warning because the old es5 script does not export its global variable.

Property 'fire' does not exist on type

import * as $ from 'jquery';

import Swal from './external/sweetalert2.all.min.js';

$('[test-btn]').on('click', (e) => {
    Swal.fire({
        position: 'top-end',
        icon: 'success',
        title: 'Your work have been saved!',
        showConfirmButton: false,
        timer: 1500
    });
});

在此处输入图像描述

My solution was doing this variant

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM