Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Doesn't work with webpack-serve using its --require or -r flag - "Unexpected token import" #399

Closed
oles opened this issue May 15, 2018 · 7 comments
Labels

Comments

@oles
Copy link

oles commented May 15, 2018

You inspire me, John-David. Really cool to see you're pushing and inspiring others to make ESM awesome. All my projects recently has "esm" inside its devdeps 👍

Which brings me to this issue. webpack -r esm works perfectly, but webpack-serve -r esm does not.
I could not find any issues regarding it here nor on https://github.com/webpack-contrib/webpack-serve

The same config file is used by both webpack and webpack-serve, but the later complains about Unexpected token import

Seems like webpack-serve is doing some magic to its require implementation: webpack-contrib/webpack-serve#83 - and it seems like this issue is on their cape.

Any suggestions before I open an issue there as well?

@oles
Copy link
Author

oles commented May 15, 2018

Ohhh....

This module will not implement TypeScript, Babel, nor any other preprocessor support. You must feed it regular JavaScript. Note: This will not change.

webpack-contrib/webpack-serve#65 (comment)

@oles oles closed this as completed May 15, 2018
@oles
Copy link
Author

oles commented May 15, 2018

Wait a minute!

The --require feature has now been added in #83.
webpack-contrib/webpack-serve#65 (comment)

Seems like it got implemented anyway - should have read the whole thread before the previous comment.

@oles oles reopened this May 15, 2018
@oles
Copy link
Author

oles commented May 15, 2018

Got it working using a tip inspired from webpack-contrib/webpack-serve#51 (comment)

node -r esm ./node_modules/.bin/webpack-serve

Though neither ideal and quite intuitive, it's okay for now. I'll open an issue over at webpack-serve, using this as a reference.

@oles
Copy link
Author

oles commented May 15, 2018

Opened at webpack-contrib/webpack-serve#138

@jdalton
Copy link
Member

jdalton commented May 15, 2018

Thanks @oles!

Update:

@oles Can you create a simple repro repo for me to check out?

@oles
Copy link
Author

oles commented May 16, 2018

@jdalton Done: https://github.com/oles/webpack-serve-esm

Thanks for looking into this 👍

@jdalton
Copy link
Member

jdalton commented May 16, 2018

Confirmed webpack-serve bug.
After fixing their bug locally the ESM config loads.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

2 participants