Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@truesparrow/adminfe / webpack.config.js
Size: Mime:
const CopyPlugin = require('copy-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const path = require('path');
const webpack = require('webpack');

// const prodPlugins = require('./webpack.prod-plugins');


module.exports = {
    target: 'web',
    entry: {
        client: './src/client/index.tsx'
    },
    output: {
        path: path.resolve(__dirname, 'out', 'client'),
        publicPath: '/real/client/',
        filename: '[name].js',
        chunkFilename: '[name].chunk.js'
    },
    module: {
        rules: [{
            test: /\.(tsx?)$/,
            include: [
                path.resolve(__dirname, 'src', 'client'),
                path.resolve(__dirname, 'src', 'shared')
            ],
            loader: 'ts-loader',
            options: {
                configFile: 'tsconfig.client.json',
                silent: true
            }
        }, {
            test: /\.(less|css)$/,
            include: [
                path.resolve(__dirname, 'src', 'client'),
                path.resolve(__dirname, 'src', 'shared')
            ],
            loader: ExtractTextPlugin.extract({
                fallback: 'style-loader',
                use: ['css-loader', 'less-loader'],
                publicPath: '/real/client/'
            })
        }, {
            test: /\.svg|.png$/,
            include: [path.resolve(__dirname, 'src', 'shared', 'static')],
            loader: 'url-loader',
            options: {
                limit: 8192,
                prefix: 'img'
            }
        }, {
            test: /\.html$/,
            include: [path.resolve(__dirname, 'src', 'shared', 'static')],
            loader: 'file-loader',
            options: {
                name: '[name].[ext]'
            }
        }, {
            test: /favicon.ico$/,
            include: [path.resolve(__dirname, 'src', 'shared', 'static')],
            loader: 'file-loader',
            options: {
                name: '[name].[ext]'
            }
        }]
    },
    plugins: [
        new webpack.DefinePlugin({
            'process.env.NODE_ENV': process.env.ENV === 'LOCAL' ? '"development"' : '"production"'
        }),
        // As we add more languages, we'll select more locales here.
        new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /en|ro/),
        // All imports of the config file are to ./shared/config.ts. When compiling things for the
        // client, we need to replace this with ./client/config.ts. Historically it didn't use
        // to be the case and we had the same config. However this turned out to be problematic
        // with newer versions of typescript.
        new webpack.NormalModuleReplacementPlugin(/^[.][/]config$/, function(result) {
            result.request = '../client/config';
        }),
        new CopyPlugin([
            {from: './src/shared/static/placeholders/avatar.svg'},
            {from: './src/shared/static/placeholders/ceremony.jpg'},
            {from: './src/shared/static/placeholders/couple.jpg'},
            {from: './src/shared/static/placeholders/sparrow.jpg'},
            {from: './src/shared/static/placeholders/loading-image-en.png'},
            {from: './src/shared/static/placeholders/loading-image-ro.png'},
            {from: './src/shared/static/index.html'},
            {from: './src/shared/static/logo-big.jpg'},
            {from: './src/shared/static/logo-auth0.jpg'},
            {from: './src/shared/static/android-chrome-192x192.png'},
            {from: './src/shared/static/android-chrome-512x512.png'},
            {from: './src/shared/static/apple-touch-icon.png'},
            {from: './src/shared/static/mstile-150x150.png'},
            {from: './src/shared/static/mstile-310x310.png'},
            {from: './src/shared/static/favicon-32x32.png'},
            {from: './src/shared/static/favicon-16x16.png'},
            {from: './src/shared/static/site.webmanifest'},
            {from: './src/shared/static/safari-pinned-tab.svg'},
            {from: './src/shared/static/favicon.ico'},
            {from: './src/shared/static/browserconfig.xml'},
            {from: './src/shared/static/humans.txt'},
            {from: './src/shared/static/robots.txt'},
            {from: './src/shared/static/sitemap.xml'},
            {from: './src/shared/static/home-page-hero.jpg'},
            {from: './src/shared/static/menu-icon.svg'},
            {from: './src/shared/static/menu-icon-close.svg'},
            {from: './src/shared/static/menu-icon-close-white.svg'},
            {from: './src/shared/static/left-arrow-white.svg'},
            {from: './src/shared/static/right-arrow-white.svg'},
            {from: './src/shared/static/main-icon.svg'},
            {from: './src/shared/static/event-icon.svg'},
            {from: './src/shared/static/site-icon.svg'},
            {from: './src/shared/static/billing-icon.svg'},
            {from: './src/shared/static/account-icon.svg'},
            {from: './src/shared/static/open-in-new-tab-icon.svg'},
            {from: './src/shared/static/powered-by-google.png'},
            {from: './out/client/vendor.bundle.js'}
        ]),
        new ExtractTextPlugin('client.css'),
        new webpack.DllReferencePlugin({
            context: '.',
            manifest: require(path.resolve(__dirname, 'out', 'client', 'vendor-manifest.json'))
        }),
        new webpack.NoEmitOnErrorsPlugin(),
        // new webpack.optimize.CommonsChunkPlugin({
        //     name: 'vendor',
        //     minChunks: function (module) {
        //         // this assumes your vendor imports exist in the node_modules directory
        //         return module.context && module.context.indexOf('node_modules') !== -1;
        //     }
        // }),
        new webpack.optimize.CommonsChunkPlugin({
            name: 'manifest'
        })
    ].concat(process.env.ENV !== 'LOCAL' ? [] /* TODO: fix this prodPlugins.prodPlugins */ : []),
    resolve: {
        extensions: ['.js', '.ts', '.tsx', '.css', '.less'],
        modules: [
            path.resolve(__dirname, 'src', 'client'),
            path.resolve(__dirname, 'src', 'shared'),
            path.resolve(__dirname, 'node_modules')
        ]
    },
    devtool: process.env.ENV !== 'LOCAL' ? 'source-map' : 'eval-cheap-module-source-map'
};