-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Working with js loaders #3
Comments
Hi! I don't exactly understand the issue you found. Check the demo in the project, I used babel-loader there, and there is not such kind of issue. Could you give some example of your module usage? |
So I modified the demo to highlight the issue I'm having https://github.com/dainyl/js-to-styles-var-loader/blob/changed-demo/demo/colors.js This is the error I'm getting:
|
For the moment the loader cannot understand es6, so temporarily you can solve the issue by using the node module system: // fancy-red.js
module.exports = '#db0f3b'; // colors.js
var fancyRed = require('./fancy-red');
module.exports = {
'fancy-red': fancyRed,
'fancy-blue': '#0f9adb',
'fancy-yellow': '#e5c63b',
'fancy-green': '#4fdd59',
'fancy-white': '#fcfff7',
'fancy-black': '#1f2120',
'fancy-pink': '#d326c8',
'fancy-lilac': '#941ece'
}; |
Or rather it cannot use the es6 module api, but node api (so you can use es6 features providing by node) |
Yep node understands most of es6 besides the module api. I've managed to work around that by running webpack with babel via http://stackoverflow.com/a/31906902. However, it would still be nice if this module could use the js loaders provided in the webpack.config. |
Hey I'm trying to use your loader in a project that is using
babel-loader
on the js. However, it seems that the way javascript is required through this module doesn't respect such loaders.I've investigated using
webpackContext.exec
as a replacement forrequire
, but ran into this issue webpack/webpack#667. That issue thread seems to imply that the functionality can be achieved using a child compiler.The text was updated successfully, but these errors were encountered: