简体   繁体   中英

Resolving alias in webpack

I am trying to resolve an alias in webpack but can't seem to figure out why this isn't working. I am using a library called GoJS. I have the below code in my module.exports of webpack:

resolve: {
        alias: {
            go: path.resolve(__dirname, './go.min.js')
        }
    }

This file is in my root project directory for now. At the top of my ES6 module I have:

import go from 'go';

I have also tried:

var go = require("go");

The library does seem to be loading. If I console.log(go) within the module, it returns an empty object. Do I need to load this file a different way because of how it is designed? Or is something wrong with my webpack settings?

Here is the javascript file I am trying to load

这可以通过将GoJS更新到更高版本(可能是1.5或更高版本)来解决,因为此后它会以不同的方式处理模块/需求/导入。

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