Webpack - 导出常量 [英] Webpack - export const

查看:35
本文介绍了Webpack - 导出常量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我第一次尝试从 systemjs 迁移到 webpack.在我的应用程序中,我有这样的事情:

I'm trying out a migration from systemjs to webpack for the first time. In my app I had something like this:

import {appSettings} from "AppSettings";

其中 AppSettings 只是一个带有常量的文件,而不是一个模块:

Where AppSettings was just a file with a const, not actually a module:

    export const appSettings = {
        somethings: {
        }
    };

这适用于 systemjs,不适用于 webpack.我能做些什么来解决这个问题?

This works with systemjs, not with webpack. Anything I can do to fix that?

推荐答案

如果您尝试导入自己的模块之一,则应使用相对路径:

If you're trying to import one of your own modules you should use a relative path:

import {appSettings} from "./AppSettings";

这篇关于Webpack - 导出常量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆