Is there any way I can make automerge work without upgrading to webpack 5? - webpack-4

I'm trying to use Automerge ( https://automerge.org/) in a Reactjs project. As described in Automerge's document, with webpack 5, to setup automerge, we need to enable "experiments.asyncWebAssemby".
Unfortunately, the project I'm working on is using webpack 4 (4.28.3) and "experiments" is not available on that version.
Is there any way I can make automerge work without upgrading to webpack 5 ?
Thankyou all for the help!
Automerge document:
https://automerge.org/docs/quickstart/
module.exports = {
experiments: { asyncWebAssembly: true },
target: 'web',
...};

Related

using ember ember-drag-sort with emblem templates

Error parsing code while looking for "npm:" imports in file: /{path}/tmp/stub_generator-input_base_path-8FTPYOxJ.tmp/dash/tests/pages/components/_component.js
SyntaxError: Unexpected token (35:13)
this when i try to run my project or build
i am using
ember 3.12
emblem 0.12.0
ember-drag-sort 3.0
I have figured out the problem it maby because of spread es6 so
I added
babel: {
plugins: [require.resolve('#babel/plugin-proposal-object-rest-spread')]
},
to ember-cli-build.js it worked

HandlebarsHelper compiled templates tempateSpec.call undefined

I am having an issue with the HandlebarsHelper compiled templates on an MVC5 site. Here is the code for the BundleConfig:
bundles.Add(new Bundle("~/bundles/templates", new HandlebarsTransformer())
.IncludeDirectory("~/App/templates", "*.hbs", true));
This was working fine locally and then I pushed to a server hosting the QA environment and I was getting an assembly reference error saying the HandlebarsHelper plugin was calling Jurassic 2.1.0.0 and it wasn't found. So I added Jurassic through Nuget, since then the templates stopped working. I get this error from the browser:
Chrome:
Uncaught TypeError: undefined is not a function
Firefox:
TypeError: templateSpec.call is not a function
This is happening in the following section of handlebars.js:
return function(context, options) {
options = options || {};
var namespace = options.partial ? options : env,
helpers,
partials;
if (!options.partial) {
helpers = options.helpers;
partials = options.partials;
}
var result = templateSpec.call(
container,
namespace, context,
helpers,
partials,
options.data);
if (!options.partial) {
env.VM.checkRevision(container.compilerInfo);
}
return result;
};
I am running:
Ember 1.7.0
Ember-Data 1.0.0-beta.11
Handlebars 1.3.0
JQuery 2.1.1
MVC 5
.Net 4.5.2
I have been searching online all morning and not found any answers yet that have worked, I tried removing the Jurassic Nuget package and it did not help. Any ideas would be appreciated, let me know if there is any other info that would help diagnosing the issue.
You're on a version of HandlbarsHelper that's not supported for that version of Ember.js.
There was a breaking change for version 1.9 which added support for handlebars version 2.0. This is supported in HandlebarsHelper v2.0+. As a breaking change it means 2.0+ can't be used with Ember.JS < v1.9 and Handlebars < v2.0.
The reason why it was probably working initially was because in debug templates are usually just injected into the page unminified.
Easy fix is to use HandlebarsHelper v1.1 (https://www.nuget.org/packages/HandlebarsHelper/1.1.0)
The problem was I was using a version of Handlebars Helper that only supported handlebars 2.x. Found the issue in Nuget and changed it to a different version, everything works now. Thanks for the comments.

Compiling Compass in an Ember-CLI project

I'm using ember-cli v0.0.23, and am trying to get the broccoli-compass package working with my project, and I've run into some problems.
First, in my Brocfile, I have replaced the standard Ember-CLI "blueprint" version of:
var styles = preprocessCss(appAndDependencies, prefix + '/styles', '/assets');
with the following:
var compileCompass = require('broccoli-compass');
var styles = compileCompass(appAndDependencies, 'app/styles/app.scss', {
outputStyle: 'expanded',
sassDir: 'app/styles',
imagesDir: 'public/images/'
});
However, when I run an ember build, I receive the following output:
$ ember build
[broccoli-compass] Error: Command failed: Errno::ENOENT on line ["155"] of /Library/Ruby/Gems/2.0.0/gems/compass-0.12.6/lib/compass/compiler.rb: No such file or directory - /Users/gaker/Sites/project/tmp/tree_merger-tmp_dest_dir-GrWa8Zva.tmp/app/styles/app.scss
Run with --trace to see the full backtrace. The command-line arguments was: `compass compile app/styles/app.scss --relative-assets --sass-dir app/styles --output-style expanded --images-dir public/images/ --css-dir "../compass_compiler-tmp_dest_dir-eFsq51BG.tmp"`
If I try to run the compass command that is output in the error in my terminal, it does create the file, only it is up one directory from my project root (notice --css-dir in the output).
I have tried many combinations of options sassDir, imagesDir, etc when calling compileCompass and this is the closest I've gotten.
So any ideas on what I can do to successfully get compass, broccoli-compass and ember-cli playing nicely?
Thanks in advance
You can use ember-cli-compass-compiler addon to compile compass in ember-cli apps.
Just do the following in your ember-cli app:
npm install --save-dev ember-cli-compass-compiler
This is all you need to do, everything works as expected from now on. It compiles your appname.scss file into appname.css on ember build or ember serve command.
Try this (added prefix and cssDir):
var compileCompass = require('broccoli-compass');
var styles = compileCompass(appAndDependencies, prefix + '/styles/app.scss', {
outputStyle: 'expanded',
sassDir: prefix + '/styles',
imagesDir: 'public/images/',
cssDir: '/assets'
});
Steffen

Handlebars Asset not Compiling with ember-rails after Upgrade to Rails 4

I have a Rails app with Ember on the front-end. Today, I upgraded to Rails 4 and the only issue I cannot resolve is that my Handlebars templates are not being compiled or included as an asset (in development mode). I'm not getting any error messages.
I generated a brand new Rails 4 test app and installed Ember and it serves the Handlebars files just fine. All gems in the test app are present in my app. I tried running rake rails:upgrade, and that had no effect. I tried modifying the ember-rails source to output log messages and the messages and execution paths were the same for the test app and my app.
I'm requiring the templates the same way I always did:
require_tree ./templates
I tried using ember-rails 0.11.1 and from Github master, with no luck.
Related gem versions:
* ember-data-source (0.0.5)
* ember-rails (0.11.1 4dc902b)
* ember-source (1.0.0.rc2.0)
* sprockets (2.9.0)
* sprockets-rails (2.0.0.rc3)
* barber (0.4.1)
Templates are all in app/assets/javascripts/templates and all use the extension .handlebars. Although I tried .hbs and .js.hjs too.
From the Chrome console:
Ember.TEMPLATES
Object {}
I am able to manually compile assets from the Rails command line like this:
environment = Sprockets::Environment.new
environment.append_path 'app/assets/javascripts'
a = environment['templates/test.handlebars']
a.to_s => "..compiled template.."
And the engine is registered:
environment.engines
=> {..".handlebars"=>Ember::Handlebars::Template..}
Rails.application.config.assets.paths includes the app/assets/javascripts folder, as it should.
Any help with this would be greatly appreciated, Thanks!
I've narrowed it down to the following block in ember-rail's engine.rb file. For my app, it is sending register_engine on Sprockets, not app.assets. On the fresh Rails 4 test app, it was also doing this. However, in my app when I force the execution to use app.assets, the handlebar templates are compiled.
I believe since my app was upgraded from Rails 3, somewhere some configuration is missing to properly use Sprockets. I'll post more when I know.
initializer "ember_rails.setup", :after => :append_assets_path, :group => :all do |app|
sprockets = if ::Rails::VERSION::MAJOR == 4
Sprockets.respond_to?('register_engine') ? Sprockets : app.assets
else
app.assets
end
sprockets.register_engine '.handlebars', Ember::Handlebars::Template
sprockets.register_engine '.hbs', Ember::Handlebars::Template
sprockets.register_engine '.hjs', Ember::Handlebars::Template
end
UPDATE:
For me,changing the railties order in application.rb was enough to fix the problem. I believe some other engine was clearing the Sprockets config, so by loading the Ember::Rails engine later in the process, I was able to hack a way around that issue.
config.railties_order = [:main_app, :all, Ember::Rails::Engine]

Why does sencha build app fail?

I'm allways running into this exception when I try to build my app with the sencha commandline tools. However, other apps seem to work fine. What am I missing?
UPDATE
I figured out it has something to do with the fact that I want my buildPath to be outside of the app directory. My section in the app.json looks like this:
"buildPaths": {
"production": "../deploy/frontenddemo/production",
"testing": "../deploy/frontenddemo/testing",
"package": "../deploy/frontenddemo/package",
"native": "../deploy/frontenddemo/native"
},
If I change it to:
"buildPaths": {
"production": "build/production",
...
},
Everything works as expected. I don't know why. It should be possible to have the builds outside the app directory I guess.
Ok, after a lot of try and error. I found the root cause of this issue.
My app.json looked like this:
"archivePath": "../deploy/frontenddemo/archive/",
"buildPaths": {
"testing": "../deploy/frontenddemo/testing",
"production": "../deploy/frontenddemo/production",
"package": "../deploy/frontenddemo/package",
"native": "../deploy/frontenddemo/native"
},
The problem with this structure is that both archive and builds produce a directory "sencha" outside of the configured path. Meaning they both create ../deploy/frontenddemo/sencha
with different contents. I wonder if that is documented somewhere?
The fix was easy. I just changed the paths to this:
"archivePath": "../deploy/frontenddemo/archive/",
"buildPaths": {
"testing": "../deploy/frontenddemo/builds/testing",
"production": "../deploy/frontenddemo/builds/production",
"package": "../deploy/frontenddemo/builds/package",
"native": "../deploy/frontenddemo/builds/native"
},
I've had previous issues deploying directly to a web server such as MAMP, or even Mac's default web server, in ~/Sites/
Have you tried changing your deployment directory to something other then MAMP, and then manually copy/paste it over?
Also, what exact version of the SDK are you using? 2.1 beta 3 was released a bit ago, as well as a new Sencha Cmd 3.0.0.122 (used to be called Sencha SDK Tools).
Forum Announcement: Sencha Touch 2.1.0 Beta 3 is available