Similar to this introduction of multiple modules, how to simplify it into one sentence, such as
import {A,B,C,D} from {'a.js' ,'b.js'....}
欧阳克2017-06-12 09:24:00
Created index.js
under
../img/new
import img1 from './banner.png'
...
module.exports = {
img1,
...
}
You can quote it like this
import { img1, img2 ... } from '../img/new';
学习ing2017-06-12 09:24:00
If all the files on your right are js, it’s easy to solve, just write them all in one file improt {a, b, c} from xx.js
, but the picture is...
迷茫2017-06-12 09:24:00
Take your file A that introduces multiple modules, package it separately into a module B, and then import and use module B.
学习ing2017-06-12 09:24:00
If you are using webpack you can write like this
const context = require.context('../img/new/', true, /\.(html)$/);
context.keys().forEach((filename) => {
console.log(filename, context(filename));
});