Skip to content

Commit

Permalink
chore(webpack): modify all projects webpacks.configs to reduce bundle…
Browse files Browse the repository at this point in the history
… size
  • Loading branch information
vanbasten17 committed Sep 30, 2020
1 parent a7300a3 commit f10e6ef
Show file tree
Hide file tree
Showing 56 changed files with 414 additions and 134 deletions.
5 changes: 0 additions & 5 deletions packages/botonic-cli/templates/blank/src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
export { routes } from './routes'
export { locales } from './locales'
export { plugins } from './plugins'
export { webchat } from './webchat'
export { webviews } from './webviews'
export const config = { defaultDelay: 0, defaultTyping: 0 }
19 changes: 19 additions & 0 deletions packages/botonic-cli/templates/blank/webpack-entries/dev-entry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { DevApp } from '@botonic/react'

import { routes } from '../src/routes'

import { locales } from '../src/locales'

import { plugins } from '../src/plugins'

import { webchat } from '../src/webchat'

import { config } from '../src'

export const app = new DevApp({
routes,
locales,
plugins,
...webchat,
...config,
})
11 changes: 11 additions & 0 deletions packages/botonic-cli/templates/blank/webpack-entries/node-entry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { NodeApp } from '@botonic/react'

import { routes } from '../src/routes'

import { locales } from '../src/locales'

import { plugins } from '../src/plugins'

import { config } from '../src'

export const app = new NodeApp({ routes, locales, plugins, ...config })
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { WebchatApp } from '@botonic/react'

import { webchat } from '../src/webchat'

export const app = new WebchatApp(webchat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { WebviewApp } from '@botonic/react'

import { webviews } from '../src/webviews'

import { locales } from '../src/locales'

export const app = new WebviewApp({ webviews, locales })
10 changes: 4 additions & 6 deletions packages/botonic-cli/templates/blank/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ function sourceMap(mode) {
const resolveConfig = {
extensions: ['*', '.js', '.jsx', '.ts', '.tsx'],
alias: {
BotonicProject: path.resolve(__dirname, 'src'),
webchat: path.resolve(__dirname, 'src', 'webchat'),
react: path.resolve(__dirname, 'node_modules', 'react'),
'styled-components': path.resolve(
__dirname,
Expand Down Expand Up @@ -122,7 +120,7 @@ function botonicDevConfig(mode) {
mode: mode,
devtool: sourceMap(mode),
target: 'web',
entry: path.resolve(botonicPath, 'src', 'entry.js'),
entry: path.resolve('webpack-entries', 'dev-entry.js'),
module: {
rules: [babelLoaderConfig, fileLoaderConfig, stylesLoaderConfig],
},
Expand Down Expand Up @@ -168,7 +166,7 @@ function botonicWebchatConfig(mode) {
mode: mode,
devtool: sourceMap(mode),
target: 'web',
entry: path.resolve(botonicPath, 'src', 'webchat-entry.js'),
entry: path.resolve('webpack-entries', 'webchat-entry.js'),
module: {
rules: [babelLoaderConfig, fileLoaderConfig, stylesLoaderConfig],
},
Expand Down Expand Up @@ -204,7 +202,7 @@ function botonicWebviewsConfig(mode) {
mode: mode,
devtool: sourceMap(mode),
target: 'web',
entry: path.resolve(botonicPath, 'src', 'entry.js'),
entry: path.resolve('webpack-entries', 'webviews-entry.js'),
output: {
path: path.resolve(__dirname, 'dist/webviews'),
filename: 'webviews.js',
Expand Down Expand Up @@ -253,7 +251,7 @@ function botonicServerConfig(mode) {
mode: mode,
devtool: sourceMap(mode),
target: 'node',
entry: path.resolve(botonicPath, 'src', 'entry.js'),
entry: path.resolve('webpack-entries', 'node-entry.js'),
output: {
filename: 'bot.js',
library: 'bot',
Expand Down
5 changes: 0 additions & 5 deletions packages/botonic-cli/templates/childs/src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
export { routes } from './routes'
export { locales } from './locales'
export { plugins } from './plugins'
export { webchat } from './webchat'
export { webviews } from './webviews'
export const config = { defaultDelay: 0, defaultTyping: 0 }
19 changes: 19 additions & 0 deletions packages/botonic-cli/templates/childs/webpack-entries/dev-entry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { DevApp } from '@botonic/react'

import { routes } from '../src/routes'

import { locales } from '../src/locales'

import { plugins } from '../src/plugins'

import { webchat } from '../src/webchat'

import { config } from '../src'

export const app = new DevApp({
routes,
locales,
plugins,
...webchat,
...config,
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { NodeApp } from '@botonic/react'

import { routes } from '../src/routes'

import { locales } from '../src/locales'

import { plugins } from '../src/plugins'

import { config } from '../src'

export const app = new NodeApp({ routes, locales, plugins, ...config })
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { WebchatApp } from '@botonic/react'

import { webchat } from '../src/webchat'

export const app = new WebchatApp(webchat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { WebviewApp } from '@botonic/react'

import { webviews } from '../src/webviews'

import { locales } from '../src/locales'

export const app = new WebviewApp({ webviews, locales })
10 changes: 4 additions & 6 deletions packages/botonic-cli/templates/childs/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ function sourceMap(mode) {
const resolveConfig = {
extensions: ['*', '.js', '.jsx', '.ts', '.tsx'],
alias: {
BotonicProject: path.resolve(__dirname, 'src'),
webchat: path.resolve(__dirname, 'src', 'webchat'),
react: path.resolve(__dirname, 'node_modules', 'react'),
'styled-components': path.resolve(
__dirname,
Expand Down Expand Up @@ -122,7 +120,7 @@ function botonicDevConfig(mode) {
mode: mode,
devtool: sourceMap(mode),
target: 'web',
entry: path.resolve(botonicPath, 'src', 'entry.js'),
entry: path.resolve('webpack-entries', 'dev-entry.js'),
module: {
rules: [babelLoaderConfig, fileLoaderConfig, stylesLoaderConfig],
},
Expand Down Expand Up @@ -168,7 +166,7 @@ function botonicWebchatConfig(mode) {
mode: mode,
devtool: sourceMap(mode),
target: 'web',
entry: path.resolve(botonicPath, 'src', 'webchat-entry.js'),
entry: path.resolve('webpack-entries', 'webchat-entry.js'),
module: {
rules: [babelLoaderConfig, fileLoaderConfig, stylesLoaderConfig],
},
Expand Down Expand Up @@ -204,7 +202,7 @@ function botonicWebviewsConfig(mode) {
mode: mode,
devtool: sourceMap(mode),
target: 'web',
entry: path.resolve(botonicPath, 'src', 'entry.js'),
entry: path.resolve('webpack-entries', 'webviews-entry.js'),
output: {
path: path.resolve(__dirname, 'dist/webviews'),
filename: 'webviews.js',
Expand Down Expand Up @@ -253,7 +251,7 @@ function botonicServerConfig(mode) {
mode: mode,
devtool: sourceMap(mode),
target: 'node',
entry: path.resolve(botonicPath, 'src', 'entry.js'),
entry: path.resolve('webpack-entries', 'node-entry.js'),
output: {
filename: 'bot.js',
library: 'bot',
Expand Down
5 changes: 0 additions & 5 deletions packages/botonic-cli/templates/custom-webchat/src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
export { routes } from './routes'
export { locales } from './locales'
export { plugins } from './plugins'
export { webchat } from './webchat'
export { webviews } from './webviews'
export const config = { defaultDelay: 0, defaultTyping: 0 }
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { DevApp } from '@botonic/react'

import { routes } from '../src/routes'

import { locales } from '../src/locales'

import { plugins } from '../src/plugins'

import { webchat } from '../src/webchat'

import { config } from '../src'

export const app = new DevApp({
routes,
locales,
plugins,
...webchat,
...config,
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { NodeApp } from '@botonic/react'

import { routes } from '../src/routes'

import { locales } from '../src/locales'

import { plugins } from '../src/plugins'

import { config } from '../src'

export const app = new NodeApp({ routes, locales, plugins, ...config })
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { WebchatApp } from '@botonic/react'

import { webchat } from '../src/webchat'

export const app = new WebchatApp(webchat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { WebviewApp } from '@botonic/react'

import { webviews } from '../src/webviews'

import { locales } from '../src/locales'

export const app = new WebviewApp({ webviews, locales })
10 changes: 4 additions & 6 deletions packages/botonic-cli/templates/custom-webchat/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ function sourceMap(mode) {
const resolveConfig = {
extensions: ['*', '.js', '.jsx', '.ts', '.tsx'],
alias: {
BotonicProject: path.resolve(__dirname, 'src'),
webchat: path.resolve(__dirname, 'src', 'webchat'),
react: path.resolve(__dirname, 'node_modules', 'react'),
'styled-components': path.resolve(
__dirname,
Expand Down Expand Up @@ -122,7 +120,7 @@ function botonicDevConfig(mode) {
mode: mode,
devtool: sourceMap(mode),
target: 'web',
entry: path.resolve(botonicPath, 'src', 'entry.js'),
entry: path.resolve('webpack-entries', 'dev-entry.js'),
module: {
rules: [babelLoaderConfig, fileLoaderConfig, stylesLoaderConfig],
},
Expand Down Expand Up @@ -168,7 +166,7 @@ function botonicWebchatConfig(mode) {
mode: mode,
devtool: sourceMap(mode),
target: 'web',
entry: path.resolve(botonicPath, 'src', 'webchat-entry.js'),
entry: path.resolve('webpack-entries', 'webchat-entry.js'),
module: {
rules: [babelLoaderConfig, fileLoaderConfig, stylesLoaderConfig],
},
Expand Down Expand Up @@ -204,7 +202,7 @@ function botonicWebviewsConfig(mode) {
mode: mode,
devtool: sourceMap(mode),
target: 'web',
entry: path.resolve(botonicPath, 'src', 'entry.js'),
entry: path.resolve('webpack-entries', 'webviews-entry.js'),
output: {
path: path.resolve(__dirname, 'dist/webviews'),
filename: 'webviews.js',
Expand Down Expand Up @@ -253,7 +251,7 @@ function botonicServerConfig(mode) {
mode: mode,
devtool: sourceMap(mode),
target: 'node',
entry: path.resolve(botonicPath, 'src', 'entry.js'),
entry: path.resolve('webpack-entries', 'node-entry.js'),
output: {
filename: 'bot.js',
library: 'bot',
Expand Down
5 changes: 0 additions & 5 deletions packages/botonic-cli/templates/dynamic-carousel/src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
export { routes } from './routes'
export { locales } from './locales'
export { plugins } from './plugins'
export { webchat } from './webchat'
export { webviews } from './webviews'
export const config = { defaultDelay: 0, defaultTyping: 0 }
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { DevApp } from '@botonic/react'

import { routes } from '../src/routes'

import { locales } from '../src/locales'

import { plugins } from '../src/plugins'

import { webchat } from '../src/webchat'

import { config } from '../src'

export const app = new DevApp({
routes,
locales,
plugins,
...webchat,
...config,
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { NodeApp } from '@botonic/react'

import { routes } from '../src/routes'

import { locales } from '../src/locales'

import { plugins } from '../src/plugins'

import { config } from '../src'

export const app = new NodeApp({ routes, locales, plugins, ...config })
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { WebchatApp } from '@botonic/react'

import { webchat } from '../src/webchat'

export const app = new WebchatApp(webchat)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { WebviewApp } from '@botonic/react'

import { webviews } from '../src/webviews'

import { locales } from '../src/locales'

export const app = new WebviewApp({ webviews, locales })
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ function sourceMap(mode) {
const resolveConfig = {
extensions: ['*', '.js', '.jsx', '.ts', '.tsx'],
alias: {
BotonicProject: path.resolve(__dirname, 'src'),
webchat: path.resolve(__dirname, 'src', 'webchat'),
react: path.resolve(__dirname, 'node_modules', 'react'),
'styled-components': path.resolve(
__dirname,
Expand Down Expand Up @@ -122,7 +120,7 @@ function botonicDevConfig(mode) {
mode: mode,
devtool: sourceMap(mode),
target: 'web',
entry: path.resolve(botonicPath, 'src', 'entry.js'),
entry: path.resolve('webpack-entries', 'dev-entry.js'),
module: {
rules: [babelLoaderConfig, fileLoaderConfig, stylesLoaderConfig],
},
Expand Down Expand Up @@ -168,7 +166,7 @@ function botonicWebchatConfig(mode) {
mode: mode,
devtool: sourceMap(mode),
target: 'web',
entry: path.resolve(botonicPath, 'src', 'webchat-entry.js'),
entry: path.resolve('webpack-entries', 'webchat-entry.js'),
module: {
rules: [babelLoaderConfig, fileLoaderConfig, stylesLoaderConfig],
},
Expand Down Expand Up @@ -204,7 +202,7 @@ function botonicWebviewsConfig(mode) {
mode: mode,
devtool: sourceMap(mode),
target: 'web',
entry: path.resolve(botonicPath, 'src', 'entry.js'),
entry: path.resolve('webpack-entries', 'webviews-entry.js'),
output: {
path: path.resolve(__dirname, 'dist/webviews'),
filename: 'webviews.js',
Expand Down Expand Up @@ -253,7 +251,7 @@ function botonicServerConfig(mode) {
mode: mode,
devtool: sourceMap(mode),
target: 'node',
entry: path.resolve(botonicPath, 'src', 'entry.js'),
entry: path.resolve('webpack-entries', 'node-entry.js'),
output: {
filename: 'bot.js',
library: 'bot',
Expand Down
5 changes: 0 additions & 5 deletions packages/botonic-cli/templates/dynamodb/src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
export { routes } from './routes'
export { locales } from './locales'
export { plugins } from './plugins'
export { webchat } from './webchat'
export { webviews } from './webviews'
export const config = { defaultDelay: 0, defaultTyping: 0 }
Loading

0 comments on commit f10e6ef

Please sign in to comment.