ctrlplusb / react-universally

A starter kit for universal react applications.
MIT License
1.7k stars 244 forks source link

Using with webpack-visualizer? #542

Closed Falieson closed 6 years ago

Falieson commented 6 years ago

Has anyone ran this starter kit through webpack-visualizer ?

I'm trying webpack --profile --json > webpack-stats.json --config configFactory.js and getting a unexpected token import error.

2017-typescript-react/internal/webpack on  master [?] via ⬢ v8.9.1
•100% ➜ webpack --profile --json > webpack-stats.json --config configFactory.js
/Users/sjcfmett/Github/falieson/2017-typescript-react/internal/webpack/configFactory.js:1
(function (exports, require, module, __filename, __dirname) { import appRootDir from 'app-root-dir';

                                                              ^^^^^^

SyntaxError: Unexpected token import
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:599:28)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at requireConfig (~/.nvm/versions/node/v8.9.1/lib/node_modules/webpack/bin/convert-argv.js:97:18)

In the docs it says

This starter uses Webpack 2 to produce bundles for both the client and the server.
The `internal/webpack/configFactory.js` is used to generate the respective Webpack configuration for all our bundles.
The factory is heavily commented to help you understand what is going on within the Webpack configuration.

Which makes me think that I can't just run the webpack --profile --json command against the configFactory.js file anyways.

Thanks for your replies!