gajus / isomorphic-webpack

Abstracts universal consumption of application code base using webpack.
Other
291 stars 17 forks source link

Importing styles from "node_modules" produce error #24

Closed laggingreflex closed 7 years ago

laggingreflex commented 7 years ago

Including styles from node_modules gives an error

import 'font-awesome/css/font-awesome.css';
...\isomorphic-webpack-demo\node_modules\font-awesome\css\font-awesome.css:1
(function (exports, require, module, __filename, __dirname) { @font-face {
                                                              ^
SyntaxError: Invalid or unexpected token

The error occurs when loading the page, compilation works fine.

repro: https://github.com/laggingreflex/isomorphic-webpack-demo/commit/d2b075fabd525dca824f7d7dba7730b71cdd9d6a

laggingreflex commented 7 years ago

nodeExternalsWhitelist solves it. https://github.com/laggingreflex/isomorphic-webpack-demo/commit/73bdec133833ede4f38770df31f0599221b1ac90

createIsomorphicWebpack(webpackConfiguration, {
  nodeExternalsWhitelist: [/.css$/],
  useCompilationPromise: true
});