123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- /*
- * 用来预编译第三方库*/
-
- const webpack = require('webpack');
- const pathVars = require('./pathVars');
- const packageJson = require("./../package.json");
- // const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
- //
- module.exports = {
- mode: 'development',
- entry: {
- /*第三方库*/
- dll: Object.keys(packageJson.dependencies)
- },
- output: {
- path: pathVars.dllPath,
- filename: "[name].js",
- library: '[name]',
- libraryTarget: 'umd',
- umdNamedDefine: true
- },
- plugins: [
- //new webpack.NoEmitOnErrorsPlugin(),
- new webpack.DllPlugin({
- // path 定义 manifest 文件生成的位置 [name]的部分由entry的名字替换
- path: pathVars.dllPath + '/manifest.json',
- // name 是dll暴露的对象名,要跟 output.library 保持一致
- name: '[name]',
- // context 是解析包路径的上下文,这个要跟接下来配置的dll一致
- context: pathVars.dllPath
- })
- ],
- module: {
- rules: [
- {
- test: /\.(css|less)$/,
- //exclude: [pathVars.nodeModulesPath],
- use: [
- "style-loader",
- "css-loader",
- "less-loader"
- ],
- },
- {
- test: /\.js$/,
- //exclude: pathVars.nodeModulesPath,
- loader: "babel-loader"
- }
- ]
- }
- };
|