ericalli / static-site-boilerplate

A better workflow for building modern static websites.
http://staticsiteboilerplate.com
MIT License
1.73k stars 165 forks source link

invalid 'test' regex for javascript loader #26

Closed armno closed 5 years ago

armno commented 5 years ago

Describe the bug In config/webpack.loaders.js, line 19, the test regex matches only .jsx but not .js files.

x should be optional with ? to match both .js and .jsx files.

- /\.js(x)$/
+ /\.js(x)?$/

// or something like
+ /\.jsx?$/
+ /\.(js|jsx)$/ 

(taken from https://github.com/kriasoft/react-starter-kit/blob/master/tools/webpack.config.js#L29)

tested with https://www.regextester.com/

js optional-x

To Reproduce Steps to reproduce the behavior:

  1. Create a new project from the installation guide
  2. Run $ npm install
  3. Start dev server with $ npm start
  4. In config/webpack.loaders.js, line 23, change loader from babel-loader to an invalid loader name, for example: dumbbell-loader
  5. Restart the dev server. There is no errors thrown.

Expected behavior webpack-dev-server should display an error of the invalid loader, which means the source file scripts.js get processed.

Screenshots (of the expected behavior)

Screen Shot 2019-03-14 at 10 36 39

Desktop (please complete the following information):

Additional context .js files are included in the bundle but they are not transpiled with babel-loader

✌️

ericalli commented 5 years ago

Good catch, i'll get this updated ASAP. Thanks!