Initial commit

This commit is contained in:
takiguchi
2019-12-01 16:41:11 +01:00
commit 0e3d1d8749
7 changed files with 5694 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
**/node_modules

5619
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

18
package.json Normal file
View 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
View 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
View File

@@ -0,0 +1,5 @@
export default class Entity {
constructor(id) {
this.id = id;
}
}

6
src/index.js Normal file
View 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
View 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;