123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- const path = require('path');
- const happyPack = require('happypack');
- const MiniCssExtractPlugin = require("mini-css-extract-plugin");
- const webpack = require('webpack');
- const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin');
- module.exports = {
- mode: 'development',
- entry: {},
- output: {
- filename: '[name].js',
- path: path.join(__dirname, '../dist'),
- publicPath: '/',
- library: '[name]',
- libraryTarget: 'umd',
- chunkFilename: '[name][chunkhash:8].js'
- },
- devtool: 'cheap-module-source-map',
- externals: {
- '@platform/api': '@platform/api/index',
- '@platform/base': '@platform/base/index',
- '@platform/template': '@platform/template/index',
- '@platform/form': '@platform/form/index',
- '@platform/search': '@platform/search/index',
- '@platform/table-core': '@platform/table-core/index',
- '@platform/card-table': '@platform/card-table/index',
- '@platform/edit-table': '@platform/edit-table/index',
- '@platform/simple-table': '@platform/simple-table/index',
- '@platform/transfer-table': '@platform/transfer-table/index',
- '@platform/tree-table': '@platform/tree-table/index',
- '@platform/components': '@platform/components/index',
- 'nc-lightapp-mobile': 'nc-lightapp-mobile',
- 'nc-lightapp-front': 'nc-lightapp-front',
- 'platform-workbench': 'platform-workbench',
- 'platform-report': 'platform-report',
- 'platform-login': 'platform-login',
- 'nc-report': 'nc-report',
- 'babel-polyfill': 'babel-polyfill',
- 'nc-graphic-report': 'nc-graphic-report',
- axios: {
- root: 'axios',
- var: 'axios',
- commonjs: 'axios',
- commonjs2: 'axios',
- amd: 'axios'
- },
- react: {
- root: 'React',
- var: 'React',
- commonjs: 'react',
- commonjs2: 'react',
- amd: 'react'
- },
- // redux: {
- // root: 'Redux',
- // var: 'Redux',
- // commonjs: 'redux',
- // commonjs2: 'redux',
- // amd: 'redux'
- // },
- // 'react-redux': {
- // root: 'ReactRedux',
- // var: 'ReactRedux',
- // commonjs: 'react-redux',
- // commonjs2: 'react-redux',
- // amd: 'react-redux'
- // },
- 'react-router': {
- root: 'ReactRouter',
- var: 'ReactRouter',
- commonjs: 'react-router',
- commonjs2: 'react-router',
- amd: 'react-router'
- },
- 'react-dom': {
- root: 'ReactDOM',
- var: 'ReactDOM',
- commonjs: 'react-dom',
- commonjs2: 'react-dom',
- amd: 'react-dom'
- }
- },
- resolve: {
- extensions: ['.jsx', '.js', '.less', '.css', '.json'],
- alias: {
- 'src': path.resolve(__dirname, '../src/')
- }
- },
- module: {
- rules: [{
- test: /\.(jsx|js)$/,
- exclude: /node_modules/,
- use: {
- loader: 'happypack/loader',
- options: {
- presets: ['env', 'react'],
- plugins: [
- ['import-bee', {
- "style": true
- }],
- 'transform-class-properties',
- 'transform-runtime',
- 'babel-plugin-transform-regenerator'
- ]
- }
- }
- }, {
- test: /\.less$/,
- exclude: /node_modules/,
- use: [
- MiniCssExtractPlugin.loader,
- 'css-loader',
- 'postcss-loader',
- 'less-loader'
- ]
- },
-
- {
- test: /\.css$/,
- exclude: /node_modules/,
- use: [
- MiniCssExtractPlugin.loader,
- {
- loader: 'css-loader',
- options: {
- mode: 'local',
- modules: true,
- localIdentName: '[name]--[local]--[hash:base64:5]'
- }
- },
- 'postcss-loader'
- ]
- },
- {
- test: /\.css$/,
- include: /node_modules/,
- use: [
- MiniCssExtractPlugin.loader,
- {
- loader: 'css-loader',
- options: {
- modules: false,
- }
- },
- 'postcss-loader',
- ]
- },
- {
- test: /\.(png|jpg|jpeg|gif|eot|ttf|woff|woff2|svg|svgz|xlsx)(\?.+)?$/,
- exclude: /favicon\.png$/,
- use: [{
- loader: 'url-loader'
- }]
- }]
- },
- plugins: [
- new MiniCssExtractPlugin({
- filename: '[name]_[hash:8].css'
- }),
- new happyPack({
- loaders: ['babel-loader'],
- threads: 2
- }),
- new FriendlyErrorsWebpackPlugin()
- ]
- };
|