working typescript version

This commit is contained in:
erik-sn committed 2020-10-07 12:19:55 -04:00
1 parent 581d6011e0
commit cff746aa38
119 files changed
+247 -189

No files matched your search

+34 -22
View File
@@ -1,20 +1,32 @@
const path = require('path');
const webpack = require('webpack');
const path = require("path");
const webpack = require("webpack");
module.exports = options => ({
module.exports = (options) => ({
mode: options.mode,
entry: options.entry,
output: {
path: path.resolve(process.cwd(), '../resources/html'),
filename: '[name].js',
path: path.resolve(process.cwd(), "../resources/html"),
filename: "[name].js",
},
module: {
rules: [
{
test: /\.tsx?$/,
use: [
{
loader: "ts-loader",
options: {
transpileOnly: true,
},
},
],
exclude: /node_modules/,
},
{
test: /\.jsx?$/, // Transform all .js and .jsx files required somewhere with Babel
exclude: /node_modules/,
use: {
loader: 'babel-loader',
loader: "babel-loader",
},
},
{
@@ -23,23 +35,23 @@ module.exports = options => ({
// for a list of loaders, see https://webpack.js.org/loaders/#styling
test: /\.css$/,
exclude: /node_modules/,
use: ['style-loader', 'css-loader'],
use: ["style-loader", "css-loader"],
},
{
// Preprocess 3rd party .css files located in node_modules
test: /\.css$/,
include: /node_modules/,
use: ['style-loader', 'css-loader'],
use: ["style-loader", "css-loader"],
},
{
test: /\.(eot|otf|ttf|woff|woff2)$/,
use: 'file-loader',
use: "file-loader",
},
{
test: /\.svg$/,
use: [
{
loader: 'svg-url-loader',
loader: "svg-url-loader",
options: {
// Inline files smaller than 10 kB
limit: 10 * 1024,
@@ -52,14 +64,14 @@ module.exports = options => ({
test: /\.(jpg|png|gif)$/,
use: [
{
loader: 'url-loader',
loader: "url-loader",
options: {
// Inline files smaller than 10 kB
limit: 10 * 1024,
},
},
{
loader: 'image-webpack-loader',
loader: "image-webpack-loader",
options: {
mozjpeg: {
enabled: false,
@@ -75,7 +87,7 @@ module.exports = options => ({
optimizationLevel: 7,
},
pngquant: {
quality: '65-90',
quality: "65-90",
speed: 4,
},
},
@@ -84,12 +96,12 @@ module.exports = options => ({
},
{
test: /\.html$/,
use: 'html-loader',
use: "html-loader",
},
{
test: /\.(mp4|webm)$/,
use: {
loader: 'url-loader',
loader: "url-loader",
options: {
limit: 10000,
},
@@ -102,10 +114,10 @@ module.exports = options => ({
{
loader: `ifdef-loader`,
options: {
DEBUG: options.mode !== 'production',
DEBUG: options.mode !== "production",
version: 3,
'ifdef-verbose': true, // add this for verbose output
'ifdef-triple-slash': true, // add this to use double slash comment instead of default triple slash
"ifdef-verbose": true, // add this for verbose output
"ifdef-triple-slash": true, // add this to use double slash comment instead of default triple slash
},
},
],
@@ -117,11 +129,11 @@ module.exports = options => ({
// inside your code for any environment checks; Terser will automatically
// drop any unreachable code.
new webpack.EnvironmentPlugin({
NODE_ENV: 'development',
NODE_ENV: "development",
}),
]),
resolve: {
modules: ['src', 'node_modules'],
extensions: ['.js', '.jsx', '.react.js'],
modules: ["src", "node_modules"],
extensions: [".js", ".jsx", ".ts", ".tsx", ".react.js"],
},
});
});
+9 -9
View File
@@ -1,16 +1,16 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ResourceManifestPlugin = require('./webpack.fxmanifest.plugin');
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const ResourceManifestPlugin = require("./webpack.fxmanifest.plugin");
module.exports = require('./webpack.common')({
mode: 'production',
module.exports = require("./webpack.common")({
mode: "production",
// In production, we skip all hot-reloading stuff
entry: [path.join(process.cwd(), 'src/index.js')],
entry: [path.join(process.cwd(), "src/index.tsx")],
plugins: [
new HtmlWebpackPlugin({
template: 'public/index.html',
template: "public/index.html",
minify: {
removeComments: true,
collapseWhitespace: true,
@@ -29,7 +29,7 @@ module.exports = require('./webpack.common')({
],
performance: {
assetFilter: assetFilename =>
assetFilter: (assetFilename) =>
!/(\.map$)|(^(main\.|favicon\.))/.test(assetFilename),
},
});
});