-
-
Notifications
You must be signed in to change notification settings - Fork 90
refactor: use ES Module export instead of CommonJS #69
Conversation
Codecov Report
@@ Coverage Diff @@
## master #69 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 2 2
Lines 7 7
Branches 1 1
=====================================
Hits 7 7
Continue to review full report at Codecov.
|
@niksy Thanks for PR, yep, we need update docs too, also it is major release |
Anyway code looks good, let's update docs and release new version |
Also we have example for |
On what test in |
We have in docs |
Is writing test for that necessary? It doesn’t seem to be related to this loader, but it’s working for all loaders, so the test for that should be in Webpack core, not here. |
/cc @niksy 👍 Ready for merge? |
@evilebottnawi yup, good to go! |
What about webpack's Code: import {basename} from 'path';
import {templatesFactory} from '../app/templates-factory';
const ctx = require.context('assets/images/', true, /\.svg$/);
export const SvgSpriteBundle = angular.module('SvgSpriteBundle', [])
.run(templatesFactory(ctx, 'assets/images/', key => basename(key)))
.name; |
You should use |
@ekulabuhov Yes, but it is asynchronous... |
@ViieeS Can you create new issue with minimum reproducible test repo? |
default exports though :/ |
… when requiring a template webpack-contrib/raw-loader#69
This PR contains a:
Motivation / Use-Case
Since raw-loader now works only with Webpack 4+, we can take advantage of ES Modules and scope hoisting.
Breaking Changes
If developers use CommonJS style import (
require
), they should probably useconst { default: str } = require('./string.txt')
instead ofimport str from './string.txt'
, but I haven’t tested this. Should this be documented?Additional Info
N/A.