小编bat*_*l.e的帖子

如何在webpack中导入jQuery

我在webpack上使用jquery时遇到问题。我的代码:

const path = require('path');
const webpack = require('webpack');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const CompressionPlugin = require("compression-webpack-plugin");

module.exports = {
    entry: {
        vendor: [
            './src/main/webapp/js/vendor/jquery-3.3.1.min.js',
            // './src/main/webapp/js/vendor/fs.js',
            './src/main/webapp/js/vendor/google-adsense.js',
            './src/main/webapp/js/vendor/jquery.menu-aim.min.js',
            './src/main/webapp/js/vendor/jquery.touchSwipe.min.js',
        ],
        app: './src/main/assets/js/desktop/app.js',
        mobile: './src/main/assets/js/mobile/app.js',
        touch: './src/main/assets/js/touch/app.js',
    },
    module: {
        rules: [{
                test: /\.js$/,
                exclude: /(node_modules|bower_components)/,
                use: {
                    loader: 'babel-loader',
                    options: {
                        presets: ['@babel/preset-env']
                    }
                }
            },
            {
                test: require.resolve('jquery'),
                loader: 'expose-loader?jQuery!expose-loader?$'
            }
        ],
    },
    plugins: [
        // new CleanWebpackPlugin(['src/main/webapp/assets']),
        new webpack.optimize.CommonsChunkPlugin({ …
Run Code Online (Sandbox Code Playgroud)

javascript ecmascript-6 webpack

7
推荐指数
1
解决办法
1万
查看次数

Vaadin @Tag注释

我对vaadin @Tag注释有疑问.当我在我的组件中使用这样的@Tag("主页") Edge和FF获得意想不到的类名.

@Tag("main-page")
@HtmlImport("src/page/home.html")
@Viewport("width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=no")
public class HomeView extends PolymerTemplate<HomeView.Model> implements RouterLayout, HasUrlParameter<String>,
Run Code Online (Sandbox Code Playgroud)

FF和Edge的结果:

意外的类名

但在铬,野生动物园,歌剧:

很好

任何解释?我做错了什么 ?

vaadin vaadin10

1
推荐指数
1
解决办法
345
查看次数

标签 统计

ecmascript-6 ×1

javascript ×1

vaadin ×1

vaadin10 ×1

webpack ×1