Skip to content

Commit 78b4c34

Browse files
committed
Added untracked webpack config
1 parent 65dce52 commit 78b4c34

File tree

4 files changed

+76
-1
lines changed

4 files changed

+76
-1
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
*.js
21
node_modules/
32
yarn.lock
43

src/landing/webpack.config.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const path = require('path');
2+
const HtmlWebpackPlugin = require('html-webpack-plugin');
3+
4+
const merge = require('webpack-merge');
5+
const common = require('../webpack.common.js');
6+
7+
module.exports = merge( common, {
8+
entry: path.resolve(__dirname, './index.ts'),
9+
plugins: [
10+
new HtmlWebpackPlugin({
11+
title: 'TypeScriptToLua',
12+
template: path.resolve(__dirname, '../../assets/layout/template.html'),
13+
inject: 'head',
14+
filename: 'index.html',
15+
contentFile: 'landing.html'
16+
})
17+
],
18+
output:{filename: 'landing_bundle.js'},
19+
});

src/playground/webpack.config.js

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const path = require('path');
2+
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
3+
const HtmlWebpackPlugin = require('html-webpack-plugin');
4+
const fs = require('fs');
5+
6+
const merge = require('webpack-merge');
7+
const common = require('../webpack.common.js');
8+
9+
10+
// hack to patch fs because i cant get externals to work and dont know wtf is
11+
// going on in webpack
12+
const transpilerFilePath = path.resolve(
13+
__dirname, '../../node_modules/typescript-to-lua/dist/Transpiler.js');
14+
fs.writeFileSync(
15+
transpilerFilePath,
16+
fs.readFileSync(transpilerFilePath)
17+
.toString()
18+
.replace('const fs = require("fs");', ''));
19+
20+
21+
module.exports = merge( common, {
22+
entry: path.resolve(__dirname, './index.ts'),
23+
plugins: [
24+
new MonacoWebpackPlugin({languages: ['javascript', 'typescript', 'lua']}),
25+
new HtmlWebpackPlugin({
26+
title: 'TypeScriptToLua - Online Compiler',
27+
template: path.resolve(__dirname, '../../assets/layout/template.html'),
28+
inject: 'head',
29+
filename: 'play.html',
30+
contentFile: 'play.html'
31+
})
32+
],
33+
output:{filename: 'play_bundle.js'},
34+
});

src/webpack.common.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const path = require('path');
2+
const HtmlWebpackPlugin = require('html-webpack-plugin');
3+
4+
module.exports = {
5+
devtool: 'source-map',
6+
module: {
7+
rules: [
8+
{test: /\.tsx?$/, use: 'ts-loader', exclude: /node_modules/},
9+
{test: /\.css$/, use: ['style-loader', 'css-loader']}, {
10+
test: /\.(png|svg|jpg|gif|ico)$/,
11+
use: [{
12+
loader: 'url-loader',
13+
options: {name: '[path][name].[ext]?hash=[hash:20]', limit: 8192}
14+
}]
15+
},
16+
{test: /\.scss$/, use: ['style-loader', 'css-loader', 'sass-loader']},
17+
{test: /\.webmanifest?$/, use: 'file-loader'},
18+
]
19+
},
20+
plugins: [],
21+
resolve: {extensions: ['.tsx', '.ts', '.js']},
22+
output: {path: path.resolve(__dirname, '../dist')},
23+
};

0 commit comments

Comments
 (0)