码迷,mamicode.com
首页 > Web开发 > 详细

react-webpack简单配置

时间:2018-06-21 17:36:52      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:exclude   develop   version   pre   env   TE   require   desc   bundle   

const webpack = require(‘webpack‘);
const path = require(‘path‘);
const HtmlWebpackPlugin = require(‘html-webpack-plugin‘);

module.exports = {
  entry: __dirname + ‘/src/ManageSystem.js‘,
	output: {
	  path: __dirname + ‘/build‘,
		filename: "bundle.js"
	},
	module: {
	   rules: [
		  {
		    test: /\.js$/,
				exclude: /node_modules/,
				use: [‘babel-loader‘]
		  }
		]
	},
	plugins: [
		new HtmlWebpackPlugin({
			template: __dirname+‘/template.html‘
		})
	],
	devServer: {
		publicPath: ‘/‘,
		port: 3001,
		historyApiFallback: true,
	}
}

  

{
	"presets": [
		["es2015", {"modules": false}],
		"react"
	]
}

  

{
  "name": "StaffManage",
  "version": "1.0.0",
  "description": "",
  "main": "",
  "scripts": {
    "start": "webpack",
    "dev": "webpack-dev-server  --mode development --config webpack.config.js"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "babel-core": "^6.26.3",
    "babel-loader": "^7.1.4",
    "babel-preset-env": "^1.7.0",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-react": "^6.24.1",
    "echarts": "^4.1.0",
    "html-webpack-plugin": "^3.2.0",
    "react": "^16.3.2",
    "react-dom": "^16.3.2",
    "webpack": "^4.9.1",
    "webpack-cli": "^3.0.8",
    "webpack-dev-server": "^3.1.4"
  }
}

  

react-webpack简单配置

标签:exclude   develop   version   pre   env   TE   require   desc   bundle   

原文地址:https://www.cnblogs.com/si-nian/p/9209216.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!