Skip to content

@webtrekk-smart-pixel/core does not support es module #624

@rajkeshwar

Description

@rajkeshwar

Is your feature request related to a problem? Please describe.
We use es modules for our development without any build tool to process the js files. We are not able to import @webtrekk-smart-pixel/core as es module.

Describe the solution you'd like
We should be able to import the webtrekk-smart-pixel like so.

import webtrekkSmartPixel from '@webtrekk-smart-pixel/core';
const wtSmart = webtrekkSmartPixel.use(window, window.document);

Describe alternatives you've considered
We had to load the script directly in index.html file using

<script async src="assets/js/smart-pixel.min.js"></script>

Additional context
So we are not able to load @webtrekk-smart-pixel/core in a js file. Hence we had to put initialisation code also in the html file.

<script type="text/javascript">
    window.wtSmart = window.wtSmart || [];
    window.wtSmart.push(function(wtSmart) {
        // set initial tracking config
        wtSmart.init.set({
            trackId: '###MappIntelligence TrackID###',
            trackDomain: '###MappIntelligence TrackDomain###'
        });

        // send tracking data
        wtSmart.track();
    });
</script>

Please find a plunkr link created which explains the issue.

https://plnkr.co/edit/0yKtACZNqX0kZyVc?open=lib%2Fscript.js

webtrekk-smart-pixel-es-module

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestneeds-triageThis is an un-triaged issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions