Skip to content

Instantly share code, notes, and snippets.

View harshq's full-sized avatar
👋

Harshana Abeyaratne harshq

👋
View GitHub Profile
import React, { Component } from 'react';
import {
Text,
View,
} from 'react-native';
import {
DrawerNavigator,
StackNavigator,
TabNavigator,
NavigationActions
import {
DynamoDBClient,
PutItemCommand,
GetItemCommand,
UpdateItemCommand,
DeleteItemCommand,
} from '@aws-sdk/client-dynamodb';
import {
marshall,
unmarshall
@harshq
harshq / webpack.config.js
Created June 6, 2021 09:19
serverless-webpack config
const path = require('path');
const slsw = require('serverless-webpack');
module.exports = {
mode: slsw.lib.webpack.isLocal ? 'development' : 'production',
entry: slsw.lib.entries,
stats: 'summary',
resolve: {
extensions: ['.ts'],
},
@harshq
harshq / tsconfig.json
Last active October 8, 2021 04:14
serverless tsconfig
{
"compilerOptions": {
"target": "esnext",
"module": "commonjs",
"lib": ["esnext"],
"sourceMap": true,
"outDir": "lib",
"moduleResolution": "node",
"removeComments": true,
"noImplicitAny": true,
service: sls-server
frameworkVersion: '2'
plugins:
- serverless-webpack # serverless webpack plugin
package:
individually: true # to package functions individually. You can toggle this and check the difference webpack generates
custom:
module.exports = {
en: {
linkGroups: [
{
id: 229,
name: 'Electronics',
links: [
{
name: 'Desktop Computers',
slug: 'desktop-computers',
@harshq
harshq / webpack.config.js
Created July 25, 2021 06:43
Module federation with Webpack 5
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const ModuleFederationPlugin = require("webpack/lib/container/ModuleFederationPlugin");
const dependencies = require("./package.json").dependencies;
const PORT = 3001;
module.exports = {
entry: path.resolve(__dirname, "./src/index.js"),
devServer: {
@harshq
harshq / babel.config.json
Created July 25, 2021 06:54
Module federation with Webpack 5
{
"presets": ["@babel/preset-env", ["@babel/preset-react", {
"runtime": "automatic"
}]]
}
@harshq
harshq / package.json
Created July 25, 2021 07:00
Module federation with Webpack 5
...
"scripts": {
"start": "webpack serve --open --mode development",
"build": "webpack --mode production",
"serve": "serve dist -p 3001",
"clean": "rm -rf dist"
},
...
@harshq
harshq / webpack.config.js
Last active July 25, 2021 07:49
React with Webpack 5
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const PORT = 3001;
module.exports = {
entry: path.resolve(__dirname, "./src/index.js"),
devServer: {
contentBase: path.join(__dirname, "dist"),
port: PORT,