1.0.1 • Published 3 years ago

exclude-import-loader v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

exclude-import-loader

This plug-in is used to exclude the introduction of require or import. Maybe you don't need to use "require" or "import", just use it in the development phase. Therefore, the "loader" program is to solve this problem, such as the following example

import $ from "jquery"; $(".app").eq(0).innerHTML = 'hello world';

> convert to

```javascript

$(".app").eq(0).innerHTML = 'hello world';

This plug-in is very simple. You only need one attribute to use it, which is very simple. You only need the "checkresource" attribute to complete the operation of excluding require or import

{
    test: /.js$/,
    use: [
    {
        loader: "exclude-import-loader",
        options: {
        // You can also do this: checkResource:"electron" or checkResource:/electron/
        checkResource(model, filename) {
            if (/[\\\/]src[\\\/]electron/.test(filename)) return false;
            return /electron/.test(model);
            },
        },
    }],
    exclude: /node_modules/,
},