-
Notifications
You must be signed in to change notification settings - Fork 337
Allow non-Webpack Workers Sites #1833
Allow non-Webpack Workers Sites #1833
Conversation
@@ -327,7 +321,7 @@ impl Manifest { | |||
Not inherited: Must be defined for every environment individually. | |||
*/ | |||
let mut target = Target { | |||
target_type, // Top level |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
top level is correct -- we don't let you override target_type in environments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we:
- forbid the rust type (it won't work)
- for the javascript type fail if no
[build]
, or a[build]
section with no/emptycommand
? Something like:
Workers Sites requires using a bundler, and your configuration indicates that you aren't using one. You can fix this by:
* setting your project type to "webpack" to use our automatically configured webpack bundler.
* setting your project type to "javascript", and configuring a build command in the `[build]` section if you wish to use your choice of bundler.
@@ -89,7 +97,7 @@ pub fn build( | |||
log::info!("Plain JavaScript project detected. Publishing..."); | |||
let package_dir = target.package_dir()?; | |||
let package = Package::new(&package_dir)?; | |||
let script_path = package.main(&package_dir)?; | |||
let script_path = package_dir.join(package.main(&package_dir)?); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the change here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without it, script_path
is relative to the entrypoint. By joining package_dir
with script_path
, we get an absolute path, which is needed since wrangler actually executes in the project directory (parent).
So yes, it's needed, otherwise wrangler can't find that script to deploy.
src/settings/toml/manifest.rs
Outdated
TargetType::JavaScript => { | ||
if let Some(build) = &self.build { | ||
if build.command.is_none() { | ||
failure::bail!(format!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: would be nice if this message wasn't duplicated but I'm not too bothered by it if it's inconvenient to structure the code that way
Right now, custom build commands don't work with Workers SItes. This should enable them.