Initial commit
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
**/node_modules
|
||||
5619
package-lock.json
generated
Normal file
5619
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
18
package.json
Normal file
18
package.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "webpack-test",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "webpack --watch",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"uglifyjs-webpack-plugin": "^2.2.0",
|
||||
"webpack": "^4.41.2",
|
||||
"webpack-cli": "^3.3.10",
|
||||
"webpack-dev-server": "^3.9.0"
|
||||
}
|
||||
}
|
||||
18
public/index.html
Normal file
18
public/index.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<!doctype html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title>The HTML5 Herald</title>
|
||||
<meta name="description" content="The HTML5 Herald">
|
||||
<meta name="author" content="SitePoint">
|
||||
|
||||
<link rel="stylesheet" href="css/styles.css?v=1.0">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script src="./bundle.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
5
src/entity.js
Normal file
5
src/entity.js
Normal file
@@ -0,0 +1,5 @@
|
||||
export default class Entity {
|
||||
constructor(id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
6
src/index.js
Normal file
6
src/index.js
Normal file
@@ -0,0 +1,6 @@
|
||||
import Entity from "./entity";
|
||||
|
||||
document.write("Je débute avec Webpack !");
|
||||
|
||||
const entity = new Entity('id test');
|
||||
document.write(entity.id);
|
||||
27
webpack.config.js
Normal file
27
webpack.config.js
Normal file
@@ -0,0 +1,27 @@
|
||||
const webpack = require("webpack");
|
||||
const path = require("path");
|
||||
const UglifyJSPlugin = require("uglifyjs-webpack-plugin");
|
||||
|
||||
|
||||
let config = {
|
||||
entry: "./src/index.js",
|
||||
output: {
|
||||
path: path.resolve(__dirname, "./public"),
|
||||
filename: "./bundle.js"
|
||||
},
|
||||
devServer: {
|
||||
contentBase: path.resolve(__dirname, "./public"),
|
||||
historyApiFallback: true,
|
||||
inline: true,
|
||||
open: true,
|
||||
hot: true
|
||||
},
|
||||
plugins: [
|
||||
new UglifyJSPlugin(),
|
||||
new webpack.SourceMapDevToolPlugin({})
|
||||
],
|
||||
devtool: "eval-source-map"
|
||||
}
|
||||
|
||||
|
||||
module.exports = config;
|
||||
Reference in New Issue
Block a user