segmentio / analytics.js-core

The hassle-free way to integrate analytics into any web application.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot use with webpack

paulsouche opened this issue · comments

Hi,

import * as analytics from '@segment/analytics.js-core';

Fails with webpack. Warning

WARNING in /node_modules/@segment/analytics.js-core/lib/index.js
15:20-27 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

Because of this line transpiled into

analytics.require = !(function webpackMissingModule() { var e = new Error("Cannot find module \".\""); e.code = 'MODULE_NOT_FOUND'; throw e; }());

Everything works fine without it. If this is deprecated could you please remove it ? Do you need a PR for it ?

Will have a look at ContextReplacementPlugin because seems related to webpack/webpack#2670 and webpack/webpack#2675

+1 Same issue here

Docs on using analytics.js can be found here https://segment.com/docs/sources/website/analytics.js/. Webpack is not currently supported.

Closing this issue. If this is still a problem, please reopen so that we can get it properly reprioritized.