allartk / leaflet.offline

Leaflet offline layer
https://allartk.github.io/leaflet.offline/
GNU Lesser General Public License v3.0
305 stars 76 forks source link

connect lib. Module parse failed #339

Closed Pustamel closed 9 months ago

Pustamel commented 9 months ago

Hi! We have error, when try connect lib. Please help. "Error: Module parse failed: Unexpected token (224:39) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders

 key: getTileUrl(this._url, {
...data,
 s: this.options.subdomains?.[0]
  }),
url: getTileUrl(this._url, {

" I tried to use loader: "expose-loader", but this wasn't help me. versions:

"vue": "^2.6.11",
"leaflet": "^1.9.4",
"leaflet.offline": "^3.0.1",
"idb": "^8.0.0",

dev:

"expose-loader": "^1.0.3",
"webpack": "^4.47.0"

try connect:

 {
      test: require.resolve('leaflet.offline/dist/bundle.js'),
      loader: 'expose-loader',
      options: {
        exposes: [{
          globalName: 'L.control.offline'
        }]
      }
    }

Which loader we can try to use? Or reason is not in loader?

allartk commented 9 months ago

I'm unsure what is causing the error.

But, as far as I know, no webpack loader is required to use leaflet.offline (see https://github.com/allartk/leaflet.offline/blob/master/docs/webpack.config.js). I do not know what expose-loader does, but I guess, you shouldn't use it.

Please check:

For general build questions, you might get a quicker answer at stack overflow.

allartk commented 9 months ago

No answer