Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
WQNMLGM committed Aug 6, 2018
1 parent 3afb6c9 commit ef705e6
Show file tree
Hide file tree
Showing 5 changed files with 6,058 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.DS_Store
node_modules
dist
*.log
.idea
Binary file added favicon.ico
Binary file not shown.
37 changes: 37 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "react-demo",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"dev": "node_modules/.bin/webpack-dev-server",
"dist": "node_modules/.bin/webpack -p"
},
"devDependencies": {
"babel-core": "6.26.0",
"babel-loader": "7.1.2",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-preset-env": "1.6.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "6.24.1",
"babel-preset-stage-0": "^6.24.1",
"css-loader": "0.28.8",
"extract-text-webpack-plugin": "3.0.2",
"file-loader": "1.1.6",
"html-webpack-plugin": "2.30.1",
"node-sass": "4.7.2",
"sass-loader": "6.0.6",
"style-loader": "0.19.1",
"url-loader": "0.6.2",
"webpack": "3.10.0",
"webpack-dev-server": "2.9.7"
},
"dependencies": {
"prop-types": "15.6.0",
"rc-pagination": "1.15.1",
"react": "16.2.0",
"react-dom": "16.2.0",
"react-router-dom": "4.2.2",
"simditor": "^2.3.6"
}
}
106 changes: 106 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
const path = require('path');
const webpack = require("webpack");
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require("extract-text-webpack-plugin");

module.exports = {
entry: './src/app.jsx',
output: {
path: path.resolve(__dirname, 'dist'),
publicPath: '/dist/',
filename: 'js/app.js'
},
resolve: {
//配置路径别名
alias: {
page: path.resolve(__dirname, 'src/page'),
component: path.resolve(__dirname, 'src/component'),
util: path.resolve(__dirname, 'src/util'),
service: path.resolve(__dirname, 'src/service')

}
},
module: {
rules: [
{
test: /\.(jsx|js)$/,
exclude: /(node_modules)/,
use: {
loader: 'babel-loader?presets[]=react,presets[]=env,presets[]=stage-0',
options: {
presets: ['env', 'react', 'stage-0'],
plugins: ["transform-class-properties"]
}
}
},
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: "style-loader",
use: "css-loader"
})
},
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader', 'sass-loader']
})
},
{
test: /\.(png|jpg|gif)$/,
use: [
{
loader: 'url-loader',
options: {
limit: 8192,
name: 'resource/[name].[ext]'
}
}
]
},
{
test: /\.(woff|woff2|eot|ttf|svg|otf)$/,
use: [
{
loader: 'url-loader',
options: {
limit: 8192,
name: 'resource/[name].[ext]'
}
}
]
}
]
},
plugins: [
//处理HTML文件
new HtmlWebpackPlugin({
template: './src/index.html',
favicon: './favicon.ico'
}),
//独立css文件
new ExtractTextPlugin("css/[name].css"),
//提出公共模块
new webpack.optimize.CommonsChunkPlugin({
name: 'common',
filename: 'js/base.js'
}),
],
devServer: {
port: 10086,
historyApiFallback: {
index: '/dist/index.html'
},
proxy: {
'/manage': {
target: 'http://admintest.happymmall.com',
changeOrigin: true
},
'/user/logout.do': {
target: 'http://admintest.happymmall.com',
changeOrigin: true
}
}
}
};
Loading

0 comments on commit ef705e6

Please sign in to comment.