Skip to content
This repository has been archived by the owner on Sep 29, 2022. It is now read-only.

Fix server side rendering error #36

Merged
merged 5 commits into from
Jan 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]
### Added
- Implement `Options` component. (#33)
- Add webpack target `node` (#36)

## [0.0.1] - 2019-01-18
- Initial release.
1 change: 0 additions & 1 deletion packages/web-ui/src/Book/LandscapeBook/styles.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import css from "@emotion/css";
import { TextAlignProperty } from "csstype";

export const landscapeBook = {
Expand Down
2 changes: 1 addition & 1 deletion packages/web-ui/styleguide.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const path = require('path');
const { parse: propsParser } = require('react-docgen-typescript');
const webpackConfig = require('./webpack.config');
const webpackConfig = require('./webpack.config.web');
const pkg = require('./package.json');

module.exports = {
Expand Down
54 changes: 54 additions & 0 deletions packages/web-ui/webpack.config.common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
const CleanWebpackPlugin = require('clean-webpack-plugin');
const { CheckerPlugin } = require('awesome-typescript-loader');
const path = require('path');

const srcDir = path.join(__dirname, 'src');
const outDir = path.join(__dirname, 'dist');

module.exports = {
entry: path.join(srcDir, 'index.ts'),
output: {
path: outDir,
},
mode: 'production',
devtool: 'source-map',
externals: {
react: 'react',
'react-dom': 'react-dom',
'react-dom/server': 'react-dom/server',
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
},
module: {
rules: [
{
enforce: 'pre',
test: /\.(ts|tsx)$/,
include: srcDir,
use: ['tslint-loader'],
},
{
test: /\.(ts|tsx)$/,
include: srcDir,
use: ['babel-loader', 'awesome-typescript-loader'],
},
{
test: /\.svg$/,
use: [
{
loader: '@svgr/webpack',
options: {
prettier: false,
svgo: false,
},
},
],
},
],
},
plugins: [
new CleanWebpackPlugin([outDir]),
new CheckerPlugin(),
],
};
61 changes: 6 additions & 55 deletions packages/web-ui/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,56 +1,7 @@
const CleanWebpackPlugin = require('clean-webpack-plugin');
const { CheckerPlugin } = require('awesome-typescript-loader');
const path = require('path');
const webConfig = require('./webpack.config.web');
const nodeConfig = require('./webpack.config.node');

const srcDir = path.join(__dirname, 'src');
const outDir = path.join(__dirname, 'dist');

module.exports = {
entry: path.join(srcDir, 'index.ts'),
output: {
path: outDir,
filename: 'index.js',
libraryTarget: 'commonjs2',
},
mode: 'production',
devtool: 'source-map',
externals: {
react: 'react',
'react-dom': 'react-dom',
'react-dom/server': 'react-dom/server',
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
},
module: {
rules: [
{
enforce: 'pre',
test: /\.(ts|tsx)$/,
include: srcDir,
use: ['tslint-loader'],
},
{
test: /\.(ts|tsx)$/,
include: srcDir,
use: ['babel-loader', 'awesome-typescript-loader'],
},
{
test: /\.svg$/,
use: [
{
loader: '@svgr/webpack',
options: {
prettier: false,
svgo: false,
},
},
],
},
],
},
plugins: [
new CleanWebpackPlugin([outDir]),
new CheckerPlugin(),
],
};
module.exports = [
webConfig,
nodeConfig,
];
13 changes: 13 additions & 0 deletions packages/web-ui/webpack.config.node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const _ = require('lodash');
const commonConfig = require('./webpack.config.common');

module.exports = _.merge({},
commonConfig,
{
target: 'node',
output: {
filename: 'index.node.js',
libraryTarget: 'commonjs2',
},
},
);
12 changes: 12 additions & 0 deletions packages/web-ui/webpack.config.web.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const _ = require('lodash');
const commonConfig = require('./webpack.config.common');

module.exports = _.merge({},
commonConfig,
{
output: {
filename: 'index.js',
libraryTarget: 'commonjs2',
},
},
);