forked from ruanyf/webpack-demos
-
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
Showing
32 changed files
with
308 additions
and
199 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
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.h1 { | ||
color:red; | ||
} | ||
|
||
:global(.h2) { | ||
color: blue; | ||
} |
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,5 +1,8 @@ | ||
<html> | ||
<body> | ||
<script src="bundle.js"></script> | ||
</boby> | ||
<h1 class="h1">Hello World</h1> | ||
<h2 class="h2">Hello Webpack</h2> | ||
<div id="example"></div> | ||
<script src="./bundle.js"></script> | ||
</body> | ||
</html> |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
var React = require('react'); | ||
var style = require('./app.css'); | ||
|
||
React.render( | ||
<div> | ||
<h1 className={style.h1}>Hello World</h1> | ||
<h2 className="h2">Hello Webpack</h2> | ||
</div>, | ||
document.getElementById('example') | ||
); |
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,15 +1,12 @@ | ||
var webpack = require('webpack'); | ||
var uglifyJsPlugin = webpack.optimize.UglifyJsPlugin; | ||
module.exports = { | ||
entry: './main.js', | ||
entry: './main.jsx', | ||
output: { | ||
filename: 'bundle.js' | ||
}, | ||
plugins: [ | ||
new uglifyJsPlugin({ | ||
compress: { | ||
warnings: false | ||
} | ||
}) | ||
] | ||
} | ||
module: { | ||
loaders:[ | ||
{ test: /\.js[x]?$/, exclude: /node_modules/, loader: 'jsx-loader' }, | ||
{ test: /\.css$/, loader: 'style-loader!css-loader?modules' } | ||
] | ||
} | ||
}; |
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,5 +1,5 @@ | ||
<html> | ||
<body> | ||
<script src="bundle.js"></script> | ||
</body> | ||
</boby> | ||
</html> |
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,5 +1,3 @@ | ||
document.write('<h1>Hello World</h1>'); | ||
|
||
if (__DEV__) { | ||
document.write(new Date()); | ||
} | ||
var longVariableName = 'Hello'; | ||
longVariableName += ' World'; | ||
document.write('<h1>' + longVariableName + '</h1>'); |
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,13 +1,15 @@ | ||
var webpack = require('webpack'); | ||
|
||
var devFlagPlugin = new webpack.DefinePlugin({ | ||
__DEV__: JSON.stringify(JSON.parse(process.env.DEBUG || 'false')) | ||
}); | ||
|
||
var uglifyJsPlugin = webpack.optimize.UglifyJsPlugin; | ||
module.exports = { | ||
entry: './main.js', | ||
output: { | ||
filename: 'bundle.js' | ||
}, | ||
plugins: [devFlagPlugin] | ||
}; | ||
plugins: [ | ||
new uglifyJsPlugin({ | ||
compress: { | ||
warnings: false | ||
} | ||
}) | ||
] | ||
} |
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,9 +1,5 @@ | ||
<html> | ||
<body> | ||
<div id="a"></div> | ||
<div id="b"></div> | ||
<script src="init.js"></script> | ||
<script src="bundle1.js"></script> | ||
<script src="bundle2.js"></script> | ||
</body> | ||
<body> | ||
<script src="bundle.js"></script> | ||
</body> | ||
</html> |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
document.write('<h1>Hello World</h1>'); | ||
|
||
if (__DEV__) { | ||
document.write(new Date()); | ||
} |
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,18 +1,13 @@ | ||
var CommonsChunkPlugin = require("webpack/lib/optimize/CommonsChunkPlugin"); | ||
var webpack = require('webpack'); | ||
|
||
var devFlagPlugin = new webpack.DefinePlugin({ | ||
__DEV__: JSON.stringify(JSON.parse(process.env.DEBUG || 'false')) | ||
}); | ||
|
||
module.exports = { | ||
entry: { | ||
bundle1: './main1.jsx', | ||
bundle2: './main2.jsx' | ||
}, | ||
entry: './main.js', | ||
output: { | ||
filename: '[name].js' | ||
}, | ||
module: { | ||
loaders:[ | ||
{ test: /\.js[x]?$/, exclude: /node_modules/, loader: 'jsx-loader' }, | ||
] | ||
filename: 'bundle.js' | ||
}, | ||
plugins: [ | ||
new CommonsChunkPlugin('init.js') | ||
] | ||
} | ||
plugins: [devFlagPlugin] | ||
}; |
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,7 +1,9 @@ | ||
<html> | ||
<body> | ||
<h1></h1> | ||
<script src="vendor.js"></script> | ||
<script src="bundle.js"></script> | ||
<div id="a"></div> | ||
<div id="b"></div> | ||
<script src="init.js"></script> | ||
<script src="bundle1.js"></script> | ||
<script src="bundle2.js"></script> | ||
</body> | ||
</html> |
File renamed without changes.
File renamed without changes.
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,14 +1,18 @@ | ||
var webpack = require('webpack'); | ||
|
||
var CommonsChunkPlugin = require("webpack/lib/optimize/CommonsChunkPlugin"); | ||
module.exports = { | ||
entry: { | ||
app: './main.js', | ||
vendor: ['jquery'], | ||
bundle1: './main1.jsx', | ||
bundle2: './main2.jsx' | ||
}, | ||
output: { | ||
filename: 'bundle.js' | ||
filename: '[name].js' | ||
}, | ||
module: { | ||
loaders:[ | ||
{ test: /\.js[x]?$/, exclude: /node_modules/, loader: 'jsx-loader' }, | ||
] | ||
}, | ||
plugins: [ | ||
new webpack.optimize.CommonsChunkPlugin(/* chunkName= */'vendor', /* filename= */'vendor.js') | ||
new CommonsChunkPlugin('init.js') | ||
] | ||
}; | ||
} |
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,6 +1,7 @@ | ||
<html> | ||
<body> | ||
<script src="data.js"></script> | ||
<h1></h1> | ||
<script src="vendor.js"></script> | ||
<script src="bundle.js"></script> | ||
</body> | ||
</html> |
File renamed without changes.
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,17 +1,14 @@ | ||
var webpack = require('webpack'); | ||
|
||
module.exports = { | ||
entry: './main.jsx', | ||
entry: { | ||
app: './main.js', | ||
vendor: ['jquery'], | ||
}, | ||
output: { | ||
filename: 'bundle.js' | ||
}, | ||
module: { | ||
loaders:[ | ||
{ test: /\.js[x]?$/, exclude: /node_modules/, loader: 'jsx-loader' }, | ||
] | ||
}, | ||
externals: { | ||
// require("jquery") is external and available | ||
// on the global var jQuery | ||
// "jquery": "jQuery" | ||
'data': 'data' | ||
} | ||
plugins: [ | ||
new webpack.optimize.CommonsChunkPlugin(/* chunkName= */'vendor', /* filename= */'vendor.js') | ||
] | ||
}; |
File renamed without changes.
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,6 +1,6 @@ | ||
<html> | ||
<body> | ||
<div id='root'></div> | ||
<script src="/static/bundle.js"></script> | ||
<script src="data.js"></script> | ||
<script src="bundle.js"></script> | ||
</body> | ||
</html> |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
Oops, something went wrong.