UNPKG

qdt-lui

Version:
91 lines (89 loc) 2.37 kB
const path = require('path'); const webpack = require('webpack'); const UglifyJsPlugin = require('uglifyjs-webpack-plugin'); module.exports = { devtool: 'source-map', entry: { "qdt-lui": "./src/index", "qdt-lui.min": "./src/index", }, mode: 'production', output: { path: path.resolve(__dirname, 'dist'), publicPath: 'node_modules/qdt-lui/dist/', filename: "[name].js", library: 'QdtLui', libraryTarget: 'umd', umdNamedDefine: true, jsonpFunction: 'jsonpQdtLui' }, module: { rules: [ { test: /\.(js|jsx)$/, exclude: /node_modules/, use: [ 'babel-loader', { loader: 'eslint-loader', options: { fix: true, }, }, ], }, { test: /\.(scss|css)$/, use: [ "style-loader", // creates style nodes from JS strings "css-loader", // translates CSS into CommonJS "sass-loader" // compiles Sass to CSS, using Node Sass by default ], }, { test: /\.(ttf|eot|woff|woff2)$/, loader: "file-loader", options: { name: "[name].[ext]", }, }, ], }, plugins: [ function() { this.plugin('watch-run', function(watching, callback) { let date = new Date(); let displayDate = `${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}` console.log('\x1b[36m%s\x1b[0m', `----------------------------`); console.log('\x1b[36m%s\x1b[0m', `Start compiling at ${displayDate}`); //cyan console.log('\x1b[36m%s\x1b[0m', `----------------------------`); callback(); }) }, ], resolve: { extensions: ['.js', '.jsx'], alias: { 'react': path.resolve('./node_modules/react'), 'react-dom': path.resolve('./node_modules/react-dom') } }, optimization: { minimizer: [ new UglifyJsPlugin({ include: /\.min\.js$/, uglifyOptions: { warnings: true, parse: {}, compress: false, mangle: true, // Note `mangle.properties` is `false` by default. output: null, toplevel: false, nameCache: null, ie8: false, keep_fnames: false, }, }), ], }, };