【发布时间】:2017-07-27 15:00:41
【问题描述】:
我想仅从 Moment.js 加载 2 个语言环境 en-gb 和 fr-ch,然后将 moment 类分配给 scopewindow 以在我的任何地方使用该库Vuejs 组件。
目前,我的app.js 有这个要求行:
window.moment = require('moment')
我怀疑它可以通过 solutions here 来完成(将 IgnorePlugin 和 ContextReplacementPlugin 添加到 webpack.config.js):
plugins.push(new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /en-gb|fr-ch/))
module.exports.plugins = plugins;
或
plugins.push(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/))
module.exports.plugins = plugins;
在导入 momentjs 时,您应该在哪里添加这些代码(webpack.config.js 和/或 app.js 和/或 webpack.mix.js)以忽略所有其他语言环境?
【问题讨论】:
标签: laravel webpack momentjs laravel-mix