-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
scss - import not removed from bundle #3052
Comments
The JS bundle says Your issue is that the JS bundle still contains |
It also attempts to load the .scss file, that is the problem. I have to deploy an empty index.scss to the server. |
Could you create a minimal example when this happens? |
@mischnic Ok, it does work. However, I'm using parceljs to build a library. Then in an app I use Browserify to build. Apparently, browserify interprets the 'require' as commonjs?.... Close if parcel does not support something like this. |
Webpack and browserify both think the The library you built with parcel contains a line like this (for a non minified bundle var nodeRequire = typeof require === 'function' && require; Could you try replacing that with var nodeRequire = null; and testing how browserify behaves then? |
@mischnic - var nodeRequire = null does not work. However, if I delete the line; |
Ok, I'll have to investigate how we can make webpack and browserify ignore the I'll close this issue because it's caused by the same underlying problem as #2883 |
Note, I strongly advise not using Parcel's feature of importing style in a library. Reasons:
|
@mischnic - Yes I did that as my work around. Works fine. There is one other issue with using Parcel to build a library. The bundle scopes |
❔ Question
Using import "./scss/index.scss"; bundle has require("./scss/index.scss"); and when the bundle is loaded expects the file to exist on the server. The css has already been produced and is loaded properly. So, why does the ".scss" file have to be visible?
🔦 Context
Using gulp to build -
const options = {
production: isProduction,
outDir: '../' + dist,
contentHash: false,
outFile: isProduction ? 'index.html' : 'index_dev.html',
publicUrl: watch ? '' : './',
watch: watch,
cache: !isProduction,
cacheDir: '.cache',
minify: isProduction,
target: 'browser',
https: false,
logLevel: 3,
sourceMaps: !isProduction,
detailedReport: isProduction
};
Must provide .scss file on production server
💻 Code Sample
🌍 Your Environment
The text was updated successfully, but these errors were encountered: