webpack-contrib / imports-loader

Imports Loader
MIT License
520 stars 63 forks source link

Invalid regular expression: invalid group specifier name #87

Closed killmenot closed 4 years ago

killmenot commented 4 years ago

Expected Behavior

No errors

Actual Behavior

Invalid regular expression: invalid group specifier name

Screenshot 2020-10-06 at 13 39 54

Code

webpack.config.js https://gist.github.com/killmenot/ca5f2efd020e7c5870fc671910e520b0

// app.js
import 'imports-loader?this=>window|jquery.appear'
import 'imports-loader?window.jQuery=jquery|jquery-countto'

How Do We Reproduce?

Open in Safari (Chrome works OK)

Information

  1. Problem was found after migration from 0.8.0 to 1.1.0
  2. Also, there is an open ticket here: https://github.com/jonschlinkert/strip-comments/issues/58
cap-Bernardito commented 4 years ago

Please provide a minimally reproducible test repository

killmenot commented 4 years ago

https://github.com/killmenot/imports-loader-87

cap-Bernardito commented 4 years ago

You are using the wrong syntax, and add the imports-loader itself to the bundle. There have been big changes in version 1.0.0. Please read them and the current documentation.

You probably want something like this:

import 'imports-loader?wrapper=window!jquery.appear'
import 'imports-loader?wrapper=window&imports=default|jquery|jQuery!jquery-countto'

If you are missing the inline syntax, you can use webpack.config. There is a additionalCode option and advanced wrapper options available.

killmenot commented 4 years ago

Thanks!