<!doctype html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<style type="text/css">html, body {
margin: 0;
padding: 0;
overflow: hidden; }
</style></head>
<body>
<div class="content"></div>
<script type="text/javascript" src="vendors.js?hash=5b9a9a27cd0f7aaf8f92"></script><script type="text/javascript" src="main.js?hash=636b0b5f62b583fe5fcc"></script></body>
<script> src="./src/js/index.js"</script>
</html>
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const path = require("path");
var HtmlWebpackInlineSourcePlugin = require('html-webpack-inline-source-plugin');
module.exports = {
mode: "none",
entry: ["./src/js/index.js", "./src/styles/default.sass"],
output: {
filename: "main.js?hash=[contenthash]",
path: path.resolve(__dirname, "dist"),
chunkFilename: "[name].js?hash=[contenthash]",
},
optimization: {
splitChunks: {
cacheGroups: {
vendors: {
test: /[\\/]node_modules[\\/]/,
name: "vendors",
chunks: "initial",
},
},
},
},
module: {
rules: [
{
test: /\.(sass)$/,
use: ExtractTextPlugin.extract({
fallback: "style-loader",
use: ["css-loader", "sass-loader"],
}),
},
{
test: /\.js$/,
exclude: /(node_modules|bower_components|dist)/,
use: {
loader: "babel-loader",
options: {
presets: ["@babel/preset-env"],
},
},
},
],
},
plugins: [
new ExtractTextPlugin("styles.css"),
new HtmlWebpackPlugin({
title: "clear engine",
template: "index.html",
inlineSource: '.(js|css)$' // embed all javascript and css inline
}),
new HtmlWebpackInlineSourcePlugin()
],
resolve: {
alias: {
"@images": path.resolve(__dirname, "./src/base64/images.js"),
"@styles": path.resolve(__dirname, "./src/styles/default.sass"),
},
},
};
const projectName = process.argv.splice(5)[0];
console.log(process.env.PROJECT)
"scripts": {
"start": "npx webpack --config ./configs/$PROJECT.config.js --watch",
"start": "ls ./configs/$PROJECT"
},
PROJECT=orel npm run start