Tiny-slider: Can't load tiny-slider with laravel mix

Created on 28 Jan 2020  路  3Comments  路  Source: ganlanyuan/tiny-slider

Installed tiny-slider via npm, then it created on node_modules the folder tiny-slider, then in app.js I tryed the following and nothing works:

require('tiny-slider');
import 'tiny-slider/src/tiny-slider';
require('tiny-slider/src/tiny-slider');
import 'tiny-slider/src/tiny-slider.js';
import 'tiny-slider/src/tiny-slider.module.js';

tryed pointing on dist too and also like documentation says:

import { tns } from "./node_modules/tiny-slider/src/tiny-slider"
import {tns} from './src/tiny-slider.js';
import { tns } "tiny-slider/src/tiny-slider";

Most helpful comment

@CristianEstiber
I have tiny-slider working with laravel mix

import { tns } from 'tiny-slider/src/tiny-slider;

let slider = tns({
  //place parameters here
});

From my understanding you need to ensure that you are calling the tns object otherwise webpack will not load the package into your bundle.
Hope this helps!

All 3 comments

@CristianEstiber
I have tiny-slider working with laravel mix

import { tns } from 'tiny-slider/src/tiny-slider;

let slider = tns({
  //place parameters here
});

From my understanding you need to ensure that you are calling the tns object otherwise webpack will not load the package into your bundle.
Hope this helps!

@mdvacula is right but the last quote is missing:

import { tns } from "tiny-slider/src/tiny-slider";

Another thing to note is that you have to import tns in the file where you are using tns otherwise it won't work. For example, if you have a custom.js file where you are using tns and which is being required via app.js then you have to add the import in custom.js and not app.js

Was this page helpful?
0 / 5 - 0 ratings

Related issues

notrealdev picture notrealdev  路  5Comments

snnsnn picture snnsnn  路  3Comments

DimaGashko picture DimaGashko  路  3Comments

nandes2062 picture nandes2062  路  5Comments

DimaGashko picture DimaGashko  路  3Comments