Issues (11)

webpack.config.js (2 issues)

1
let libraryName = "TCM-couscous-theme";
0 ignored issues
show
The variable libraryName seems to be never used. Consider removing it.
Loading history...
2
let path = require("path");
3
let webpack = require("webpack");
4
let ExtractTextPlugin = require("extract-text-webpack-plugin");
5
6
module.exports = {
7
    entry: path.resolve(__dirname, './app.js'),
8
    output: {
9
        path: './assets/',
10
        filename: 'app.bundle.js',
11
        publicPath: ''
12
        //library: libraryName,
13
        //libraryTarget: 'umd',
14
        //umdNamedDefine: true
15
    },
16
    devtool: 'source-map',
17
    module: {
18
        loaders: [
19
            { test: /\.css$/, loader: ExtractTextPlugin.extract({ fallback:'style-loader', use:'css-loader'}) },
20
            { test: /\.less$/, loader: ExtractTextPlugin.extract({ fallback:'style-loader', use:'css-loader!less-loader'}) },
21
            { test: /\.png$/, loader: "url-loader?limit=100000",
22
                query: {
23
                    name: 'images/[name].[ext]'
24
                }},
25
            { test: /\.jpg$/, loader: "file-loader",
26
                query: {
27
                    name: 'images/[name].[ext]'
28
                }},
29
            { test: /\.gif$/, loader: "file-loader",
30
                query: {
31
                    name: 'images/[name].[ext]'
32
                }},
33
            { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "url-loader",
34
                query: {
35
                    limit: 10000,
36
                    mimetype: 'application/font-woff',
37
                    name: 'fonts/[name].[ext]'
38
                }},
39
            { test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "file-loader",
40
                query: {
41
                    limit: 10000,
42
                    name: 'fonts/[name].[ext]'
43
                }},
44
45
            /*{ test: /\.(woff2?|ttf|eot|svg)$/, loader: 'url-loader?limit=10000' },*/
46
            { test: /\.js$/, loader: "babel-loader", query: {cacheDirectory: true, presets: [__dirname+"/node_modules/babel-preset-es2015"]}}
0 ignored issues
show
Consider using the path module for constructing paths since they are otherwise not cross-OS compatible.
Loading history...
47
        ]
48
    },
49
    plugins: [
50
        // Hack to not bundle all languages from highlight.js to reduce bundle size.
51
        // See: https://bjacobel.com/2016/12/04/highlight-bundle-size/
52
        new webpack.ContextReplacementPlugin(
53
            /highlight\.js\/lib\/languages$/,
54
            new RegExp(`^./(${['javascript', 'php', 'bash', 'sql', 'css', 'less', 'json'].join('|')})$`)
55
        ),
56
        /*new webpack.ProvidePlugin({
57
            hljs: "jquery",
58
            jQuery: "jquery"
59
        })*/
60
        //new webpack.optimize.CommonsChunkPlugin("init.js"),
61
        // Extracts the CSS in CSS files (otherwise it would be bundled in the JS!)
62
        new ExtractTextPlugin("[name].css")
63
    ],
64
    resolve: {
65
        alias: {
66
            "hljs": path.join(__dirname, "node_modules/highlightjs/highlight.pack")
67
        //    'vue$': 'vue/dist/vue.common.js',
68
        //    '_components':  path.resolve(__dirname, './membership/src/components')
69
        }
70
    }//,
71
    //vue: {}
72
};