Skip to content

Commit 39d33b2

Browse files
committed
step 1, build the simple js file.
1 parent b1c44dc commit 39d33b2

File tree

7 files changed

+101
-0
lines changed

7 files changed

+101
-0
lines changed

.gitignore

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/dev/
2+
/prd/
3+
/refs/
4+
5+
6+
# kdiff3 ignore
7+
*.orig
8+
9+
# maven ignore
10+
target/
11+
12+
# eclipse ignore
13+
.settings/
14+
.project
15+
.classpath
16+
17+
# idea ignore
18+
.idea/
19+
*.ipr
20+
*.iml
21+
*.iws
22+
23+
# temp ignore
24+
*.log
25+
*.cache
26+
*.diff
27+
*.patch
28+
*.tmp
29+
30+
# system ignore
31+
.DS_Store
32+
Thumbs.db
33+
34+
# package ignore (optional)
35+
# *.jar
36+
# *.war
37+
# *.zip
38+
# *.tar
39+
# *.tar.gz
40+
41+
42+
.sass-cache
43+
/resource/
44+
/log/
45+
/node_modules/

html/index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Webpack sample!</title>
6+
</head>
7+
<body>
8+
<div class="main"></div>
9+
<script src="/prd/index.js"></script>
10+
</body>
11+
</html>

package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "webpack-sample",
3+
"version": "1.0.0",
4+
"description": "webpack sample ",
5+
"dependencies": {
6+
},
7+
"devDependencies": {
8+
"webpack": "^1.13.1",
9+
"webpack-dev-server": "^1.14.1"
10+
},
11+
"scripts": {
12+
},
13+
"keywords": [
14+
"webpack",
15+
"sample"
16+
],
17+
"author": "functions",
18+
"license": "MIT"
19+
}

src/scripts/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
var ModuleA = require('./modules/ModuleA.js');
2+
3+
4+
document.querySelector('.main').innerHTML = ModuleA.getHtml();

src/scripts/modules/ModuleA.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
module.exports = {
3+
4+
getHtml: function() {
5+
return '<h1> Hello webpack !</h1>';
6+
}
7+
}

src/styles/modules/ModuleA.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@charset 'utf-8';
2+
3+
html, body {
4+
width: 100%;
5+
height: 100%;
6+
margin: 0;
7+
background: #666;
8+
}

webpack.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
entry: './src/scripts/index.js',
3+
output: {
4+
path: './prd/',
5+
filename: 'index.js'
6+
}
7+
};

0 commit comments

Comments
 (0)