-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
12f136b
commit 077848d
Showing
9 changed files
with
1,229 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,56 @@ | ||
/** | ||
* @description webpack的基本配置 | ||
*/ | ||
"use strict" | ||
|
||
'use strict' | ||
|
||
const HtmlWebpackPlugin = require('html-webpack-plugin') | ||
const path = require('path') | ||
const HtmlWebpackPlugin = require("html-webpack-plugin") | ||
const path = require("path") | ||
|
||
module.exports = { | ||
entry: "./index.html", | ||
entry: resolve("src/main.js"), | ||
output: { | ||
path: path.join(__dirname, '../dist'), | ||
filename: '[name].[hash:4].js' | ||
path: resolve("dist"), | ||
filename: "[name].[hash:4].js" | ||
}, | ||
resolve: { | ||
extensions: [".js"], | ||
alias: { | ||
"@": resolve("src"), | ||
"@components": resolve("@/components"), | ||
"@lib": resolve("@components/lib"), | ||
"@mock": resolve("@components/mock"), | ||
"@api": resolve("@/api") | ||
} | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
loader: 'babel-loader', | ||
loader: "babel-loader", | ||
query: { | ||
presets:['es2015', 'react'] | ||
} | ||
presets: ["es2015", "react"] | ||
}, | ||
exclude: /node_modules/ | ||
}, | ||
{ | ||
test: /\.html$/, | ||
loader: 'html-loader' | ||
loader: "html-loader" | ||
}, | ||
{ | ||
test: /\.css$/, | ||
loader: 'css-loader' | ||
} | ||
] | ||
}, | ||
plugins: [ | ||
new HtmlWebpackPlugin({ | ||
filename: 'index.html', | ||
template:'index.html', | ||
filename: "index.html", | ||
template: "index.html", | ||
inject: true | ||
}) | ||
] | ||
} | ||
|
||
function resolve(dir) { | ||
return path.join(__dirname, "..", dir) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,6 @@ | |
<title>ucmp-react-ui</title> | ||
</head> | ||
<body> | ||
hello world | ||
<div id="app"></div> | ||
</body> | ||
</html> |
Oops, something went wrong.