faceyspacey / faceyspacey/require-universal-module

Export not found

Open
#10 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
29
Forks
3
PR merge metrics
No merged PRs in 30d

Description

So I have about 16 bundles ... all of them work apart from 3. The 3 that don't work are the 3 largest chunks. It appears as if the routes don't work at the SSR stage because I get "Error: export not found" - on page load. But on closer inspection (and if I turn of JavaScript) I can see something is being rendered in each case but then the client tries to render and that's when I get that error. When I turn off JavaScript - preventing the client form starting - I can see SSR is trying to and partially succeeding in loading the chunks but even then they don't seem to render properly at SSR stage.

See my client webpack config below:

```
require('dotenv/config')
const webpack = require('webpack');
const path = require('path');
const srcPath = path.resolve(__dirname, 'src');
const distPath = path.resolve(__dirname, 'dist');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const StyleLintPlugin = require('stylelint-webpack-plugin');
const {EnvironmentPlugin} = require('webpack');
const ExtractCssChunks = require("extract-css-chunks-webpack-plugin");

const LodashModuleReplacementPlugin = require('lodash-webpack-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const cssnano = require('cssnano');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;

module.exports = {
context: srcPath,
target: 'web',
node: {
fs: "empty"
},
entry: [
'babel-polyfill',
'isomorphic-fetch',
'./client/index.tsx'
],
output: {
path: distPath,
filename: '[name].js',
chunkFilename: '[name].js',
publicPath: '/'
},
resolve: {
extensions: ['.scss', '.jsx', '.js', '.tsx', '.ts'],
alias: {
'react': 'preact-compat',
'react-dom': 'preact-compat'
}
},
plugins:[
new BundleAnalyzerPlugin({
analyzerMode: 'static'
}),
new OptimizeCSSAssetsPlugin({
cssProcessor: cssnano,
cssProcessorOptions: {
discardComments: {
removeAll: true,
},
safe: true,
},
canPrint: false,
}),
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /en/),
new LodashModuleReplacementPlugin({
collections: true,
shorthands: true
}),
new webpack.optimize.UglifyJsPlugin(),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
filename: 'vendor.js',
minChunks: function (module) {
return module.context && module.context.indexOf('node_modules') !== -1;
}
}),
new ExtractCssChunks()
],
module: {
rules: [
{
test: /\.scss$/,
use: ExtractCssChunks.extract({
use: [
{
loader: 'css-loader',
options: {
camelCase: true,
importLoaders: true,
localIdentName: '[name]_[local]_[hash:base64:5]',
minimize: true,
modules: true,
namedExport: true
}
},
'resolve-url-loader',
'sass-loader',
]
})
},
{
test: /\.tsx?$/,
include: srcPath,
use: [
{
loader: 'awesome-typescript-loader'
}
]
}
]
},
devtool: 'source-map'
};

```

Bundle analyser image:

![bundle](https://user-images.githubusercontent.com/7208008/29675079-fa781ef2-88eb-11e7-9f70-1a88da3e1815.PNG)

The pages with the issues are Search, PropertyDetail and BookShowing. The three largest.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.