【发布时间】:2017-04-23 06:08:14
【问题描述】:
我正在尝试在我的项目中使用 Ramda 作为模块,以便在我的 ./app/js *.js 文件中我可以执行以下操作:
include map from 'ramda/src/map';
基本上,我希望能够轻松地将 Ramda 作为一个模块导入,以便我可以访问单独的函数,如上所示。我已将 ramda 作为模块安装在 node_modules 目录中,并使用汇总来构建用 ES6 编写的 js 文件。
我的 rollup.config.js 文件如下所示:
import babel from 'rollup-plugin-babel';
import eslint from 'rollup-plugin-eslint';
import commonjs from 'rollup-plugin-commonjs';
export default {
entry: 'app/js/main.js',
dest: 'app/min/main.min.js',
format: 'iife',
sourceMap: 'inline',
plugins: [
eslint({
'exclude': [
'app/css/**'
]
}),
babel(),
commonjs({
include: 'node_modules/**'
})
]
};
我非常感谢一些关于如何正确设置它以在./app/js 目录中使用它的建议。如果问题不清楚,请告诉我。
谢谢。
【问题讨论】:
标签: javascript ecmascript-6 babeljs rollup ramda.js