Skip to content

Commit c59b493

Browse files
committed
Merge branch 'ujjwalguptaofficial-master'
2 parents 7b55da3 + 245198c commit c59b493

File tree

22 files changed

+5868
-0
lines changed

22 files changed

+5868
-0
lines changed

frameworks/keyed/mahal/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
bin
3+
dist
4+
build
5+
logs
13.1 KB
Loading
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const { copyFileSync } = require('fs');
2+
const path = require('path');
3+
4+
5+
copyFileSync(
6+
path.join(__dirname, "../", "dist/index.html"),
7+
path.join(__dirname, "../index.html")
8+
)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
apiUrl: "/"
3+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
if (process.env.NODE_ENV == 'production') {
2+
module.exports = require('./production.js');
3+
}
4+
else {
5+
module.exports = require('./development.js');
6+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
apiUrl: "/"
3+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module "*.mahal" {
2+
import { Component } from "mahal";
3+
export default Component;
4+
}
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
const path = require('path');
2+
const MahalPlugin = require('mahal-webpack-loader/lib/plugin');
3+
const HtmlWebPackPlugin = require('html-webpack-plugin');
4+
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
5+
const CopyPlugin = require('copy-webpack-plugin');
6+
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
7+
8+
const rootFolder = path.join(__dirname, '../../');
9+
10+
const isEnvProduction = process.env.NODE_ENV === "production"
11+
12+
module.exports = {
13+
entry: './src/index.ts',
14+
devtool: 'source-map',
15+
mode: process.env.NODE_ENV || "development",
16+
module: {
17+
rules: [
18+
{
19+
test: /\.mahal?$/,
20+
// loader: 'mahal-webpack-loader',
21+
use: {
22+
loader: require.resolve('mahal-webpack-loader')
23+
},
24+
exclude: /node_modules/
25+
},
26+
{
27+
test: /\.css?$/,
28+
use: [
29+
'style-loader',
30+
'css-loader'
31+
],
32+
},
33+
{
34+
test: /\.s[ac]ss$/i,
35+
use: [
36+
// Creates `style` nodes from JS strings
37+
'style-loader',
38+
// Translates CSS into CommonJS
39+
"css-loader",
40+
// Compiles Sass to CSS
41+
"sass-loader",
42+
],
43+
},
44+
{
45+
test: /\.ts?$/,
46+
use: {
47+
loader: 'ts-loader',
48+
options: {
49+
appendTsSuffixTo: [/\.mahal$/],
50+
}
51+
},
52+
exclude: /node_modules/,
53+
},
54+
// Images
55+
{
56+
test: /\.(?:ico|gif|png|jpg|jpeg)$/i,
57+
type: 'asset/resource',
58+
},
59+
// Fonts and SVGs
60+
{
61+
test: /\.(woff(2)?|eot|ttf|otf|svg|)$/,
62+
type: 'asset/inline',
63+
},
64+
]
65+
},
66+
resolve: {
67+
extensions: ['.ts', '.js', '.css', '.mahal', '.scss'],
68+
alias: {
69+
"~": rootFolder,
70+
"@": path.join(rootFolder, 'src'),
71+
"@config": path.join(rootFolder, 'config'),
72+
"@components": path.join(rootFolder, 'src', 'components')
73+
},
74+
},
75+
output: {
76+
filename: isEnvProduction ? 'js/[name].js' : 'js/[name].js',
77+
chunkFilename: isEnvProduction ? 'js/[name].chunk.js' : 'js/[name].chunk.js',
78+
path: path.resolve(rootFolder, 'dist'),
79+
publicPath: '/'
80+
},
81+
plugins: [
82+
new MahalPlugin({
83+
lang: 'ts'
84+
}),
85+
new HtmlWebPackPlugin({
86+
// cache: true,
87+
// hash: true,
88+
template: 'src/index.html',
89+
minify: {
90+
collapseWhitespace: true,
91+
removeComments: true,
92+
removeRedundantAttributes: true,
93+
removeScriptTypeAttributes: true,
94+
removeStyleLinkTypeAttributes: true
95+
}
96+
}),
97+
new CleanWebpackPlugin(),
98+
new CopyPlugin({
99+
patterns: [{
100+
from: './assets/',
101+
to: ''
102+
}]
103+
}),
104+
// new MiniCssExtractPlugin({
105+
// filename: 'css/[name].css',
106+
// chunkFilename: 'css/[name].chunk.css',
107+
// })
108+
]
109+
};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const { merge } = require('webpack-merge');
2+
const path = require('path');
3+
const baseConfig = require('./base.config');
4+
5+
module.exports = merge(baseConfig, {
6+
devServer: {
7+
historyApiFallback: true,
8+
},
9+
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const { merge } = require('webpack-merge')
2+
const baseConfig = require('./base.config')
3+
4+
const prod = merge(baseConfig, {
5+
mode: 'production',
6+
devtool: false,
7+
output: {
8+
publicPath: 'dist/',
9+
},
10+
})
11+
12+
module.exports = prod;

0 commit comments

Comments
 (0)