How to import an entire file (javascript) with WebPack?

1

I started to study WebPack now, I was able to use it normally, however, when I want to import something from another file I need to give:

import {abc} from './my-file.js';

and the file that was imported:

export function abc() {
    console.log('MODULO 1 do projeto');
}

So far so good. But how do I import the whole file? No need to just specify the function or variable I want? I want to import the file and be able to use everything in it (variables, functions and etc ...).

I tried to give only:

import './my-file.js';

However, it does not recognize anything inside this file, it compiles normally, but an error occurs when invoking functions (function has not been defined).

So, is there any way I can import the entire file?

    
asked by anonymous 13.07.2018 / 09:27

1 answer

1

I managed to solve using Laravel Mix, by some chance if someone has the same doubt, search about Laravel Mix.

Short course on laravel-mix made by its own creator: link

Laravel Mix is a part of the pharao framework Laravel, however, it is possible to use only Laravel Mix to 'package' in an extremely simple and easy way the files sass, less, js and etc ... without using the entire framework Laravel

    
13.07.2018 / 11:13