Webpack-'velocity is not defined'

Webpack - 'velocity is not defined'

我将 webpack 与 gulp 一起使用,这是我的 webpack 配置:

webpack.config.js

const path = require('path');
var HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
module.exports = {
    output: {
        publicPath: "./dist/",
        path: path.join(__dirname, "/js/"),
        filename: "bundle.js"
    },
    module: {
        loaders: [
            {
                test: /\.js$/,
                exclude: /node_modules/,
                loader: "babel-loader",
                query: {
                    presets: ["env"]
                }
            },
            {
                test: /\.vue$/,
                loader: 'vue-loader'
            }
        ]
    },
    resolve: {
        alias: {
            moment: 'moment/src/moment'
        }
    },
    externals: {
        jquery: 'jQuery',
        $: 'jQuery',
        moment: 'moment',
        "velocity-animate": 'velocity'
    },
    plugins: [
        new HardSourceWebpackPlugin()
    ]
};

scripts.js(这就是文件中的所有内容)

import velocity from 'velocity-animate';

我收到这个错误

Uncaught ReferenceError: velocity is not defined

此行错误:

module.exports = velocity;

我是不是外部配置有问题? 这适用于 moment.js 和 jQuery,但不适用于速度...

我试过了

"velocity-animate": 'velocity'

"velocity-animate": 'velocity-animate'

"velocity-animate": '"velocity-animate"'

和 none 这些工作。如果第一个不是 'velocity-animate'(包的名称),那么无论如何 Velocity.js 都会包含在脚本中。关于这个的文档并没有真正解释如何正确配置这个

这个用例真的有可能是如此小众以至于地球上没有人可以解释它吗?

谢谢!

在这里领导 Velocity V2 的开发。

Doh - 我们错过了更新 Velocity 的导出 - 我会在今天晚些时候得到它。我们也在 module-ifying 它的过程中,所以你将能够在 Webpack 项目中导入它 "normally" (包括 tree shaking 等)——这应该在下周左右完成.

直到我按原样推送更新的版本 "Velocity" - 注意大写 "V" - 希望今天晚些时候它会移动(2.0.2@beta 将更正"velocity-animate").

的名字